MCPcopy Create free account
hub / github.com/akash-network/node / collectGenFiles

Function collectGenFiles

testutil/network/util.go:142–181  ·  view source on GitHub ↗
(cfg Config, vals []*Validator, outputDir string)

Source from the content-addressed store, hash-verified

140}
141
142func collectGenFiles(cfg Config, vals []*Validator, outputDir string) error {
143 genTime := tmtime.Now()
144
145 for i := 0; i < cfg.NumValidators; i++ {
146 cmtCfg := vals[i].Ctx.Config
147
148 nodeDir := filepath.Join(outputDir, vals[i].Moniker, "simd")
149 gentxsDir := filepath.Join(outputDir, "gentxs")
150
151 cmtCfg.Moniker = vals[i].Moniker
152 cmtCfg.SetRoot(nodeDir)
153
154 initCfg := genutiltypes.NewInitConfig(cfg.ChainID, gentxsDir, vals[i].NodeID, vals[i].PubKey)
155
156 genFile := cmtCfg.GenesisFile()
157 appGenesis, err := genutiltypes.AppGenesisFromFile(genFile)
158 if err != nil {
159 return err
160 }
161
162 appState, err := genutil.GenAppStateFromConfig(
163 cfg.Codec,
164 cfg.TxConfig,
165 cmtCfg,
166 initCfg, appGenesis,
167 banktypes.GenesisBalancesIterator{},
168 genutiltypes.DefaultMessageValidator,
169 cfg.TxConfig.SigningContext().ValidatorAddressCodec())
170 if err != nil {
171 return err
172 }
173
174 // overwrite each validator's genesis file to have a canonical genesis time
175 if err := genutil.ExportGenesisFileWithTime(genFile, cfg.ChainID, nil, appState, genTime); err != nil {
176 return err
177 }
178 }
179
180 return nil
181}
182
183func initGenFiles(cfg Config, genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, genFiles []string) error {
184 // set the accounts in the genesis state

Callers 1

NewFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected