@@ -79,6 +79,13 @@ func InitCmd(mm genesisMM) *cobra.Command {
79
79
Args : cobra .ExactArgs (1 ),
80
80
RunE : func (cmd * cobra.Command , args []string ) error {
81
81
clientCtx := client .GetClientContextFromCmd (cmd )
82
+ cdc := clientCtx .Codec
83
+
84
+ serverCtx := server .GetServerContextFromCmd (cmd )
85
+ config := serverCtx .Config
86
+
87
+ clientCtx = client .ReadHomeFlag (clientCtx , cmd )
88
+ config .SetRoot (clientCtx .HomeDir )
82
89
83
90
config := client .GetConfigFromCmd (cmd )
84
91
chainID , _ := cmd .Flags ().GetString (flags .FlagChainID )
@@ -137,13 +144,7 @@ func InitCmd(mm genesisMM) *cobra.Command {
137
144
return fmt .Errorf ("genesis.json file already exists: %v" , genFile )
138
145
}
139
146
140
- // Overwrites the SDK default denom for side-effects
141
- if defaultDenom != "" {
142
- sdk .DefaultBondDenom = defaultDenom
143
- }
144
- appGenState := mm .DefaultGenesis ()
145
-
146
- appState , err := json .MarshalIndent (appGenState , "" , " " )
147
+ appState , err := json .MarshalIndent (mbm .DefaultGenesis (cdc ), "" , " " )
147
148
if err != nil {
148
149
return errorsmod .Wrap (err , "Failed to marshal default genesis state" )
149
150
}
@@ -160,20 +161,12 @@ func InitCmd(mm genesisMM) *cobra.Command {
160
161
}
161
162
}
162
163
163
- appGenesis .AppName = version .AppName
164
- appGenesis .AppVersion = version .Version
165
- appGenesis .ChainID = chainID
166
- appGenesis .AppState = appState
167
- appGenesis .InitialHeight = initHeight
168
- appGenesis .Consensus = & types.ConsensusGenesis {
169
- Validators : nil ,
170
- Params : cmttypes .DefaultConsensusParams (),
171
- }
172
-
173
- appGenesis .Consensus .Params .Validator .PubKeyTypes = []string {consensusKey }
164
+ genDoc .ChainID = chainID
165
+ genDoc .Validators = nil
166
+ genDoc .AppState = appState
174
167
175
- if err = genutil .ExportGenesisFile (appGenesis , genFile ); err != nil {
176
- return errorsmod .Wrap (err , "Failed to export genesis file" )
168
+ if err = genutil .ExportGenesisFile (genDoc , genFile ); err != nil {
169
+ return errors .Wrap (err , "Failed to export gensis file" )
177
170
}
178
171
179
172
toPrint := newPrintInfo (config .Moniker , chainID , nodeID , "" , appState )
0 commit comments