This commit is contained in:
parent
8f494997a3
commit
6cfa58f1ce
|
@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* (x/genutil) [#10104](https://github.com/cosmos/cosmos-sdk/pull/10104) Ensure the `init` command reads the `--home` flag value correctly.
|
||||
|
||||
## [v0.44.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.0) - 2021-09-01
|
||||
|
||||
### Features
|
||||
|
|
|
@ -249,12 +249,8 @@ func readTxCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, err
|
|||
return clientCtx, nil
|
||||
}
|
||||
|
||||
// ReadHomeFlag checks if home flag is changed.
|
||||
// If this is a case, we update HomeDir field of Client Context
|
||||
/* Discovered a bug with Cory
|
||||
./build/simd init andrei --home ./test
|
||||
cd test/config there is no client.toml configuration file
|
||||
*/
|
||||
// ReadHomeFlag checks if home flag is changed. If this is a case, we update
|
||||
// HomeDir field of Client Context.
|
||||
func ReadHomeFlag(clientCtx Context, cmd *cobra.Command) Context {
|
||||
if cmd.Flags().Changed(flags.FlagHome) {
|
||||
rootDir, _ := cmd.Flags().GetString(flags.FlagHome)
|
||||
|
|
|
@ -77,6 +77,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
|
|||
serverCtx := server.GetServerContextFromCmd(cmd)
|
||||
config := serverCtx.Config
|
||||
|
||||
clientCtx = client.ReadHomeFlag(clientCtx, cmd)
|
||||
config.SetRoot(clientCtx.HomeDir)
|
||||
|
||||
chainID, _ := cmd.Flags().GetString(flags.FlagChainID)
|
||||
|
@ -113,6 +114,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
|
|||
if !overwrite && tmos.FileExists(genFile) {
|
||||
return fmt.Errorf("genesis.json file already exists: %v", genFile)
|
||||
}
|
||||
|
||||
appState, err := json.MarshalIndent(mbm.DefaultGenesis(cdc), "", " ")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Failed to marshall default genesis state")
|
||||
|
@ -133,6 +135,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
|
|||
genDoc.ChainID = chainID
|
||||
genDoc.Validators = nil
|
||||
genDoc.AppState = appState
|
||||
|
||||
if err = genutil.ExportGenesisFile(genDoc, genFile); err != nil {
|
||||
return errors.Wrap(err, "Failed to export gensis file")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue