Added the possibility of specifying custom genesis accounts and balances inside CLI tests (#8936)

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
This commit is contained in:
Riccardo Montagnin 2021-03-19 16:20:23 +01:00 committed by GitHub
parent c9ef428053
commit 129267cc92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -168,14 +168,14 @@ func initGenFiles(cfg Config, genAccounts []authtypes.GenesisAccount, genBalance
return err
}
authGenState.Accounts = accounts
authGenState.Accounts = append(authGenState.Accounts, accounts...)
cfg.GenesisState[authtypes.ModuleName] = cfg.Codec.MustMarshalJSON(&authGenState)
// set the balances in the genesis state
var bankGenState banktypes.GenesisState
cfg.Codec.MustUnmarshalJSON(cfg.GenesisState[banktypes.ModuleName], &bankGenState)
bankGenState.Balances = genBalances
bankGenState.Balances = append(bankGenState.Balances, genBalances...)
cfg.GenesisState[banktypes.ModuleName] = cfg.Codec.MustMarshalJSON(&bankGenState)
appGenStateJSON, err := json.MarshalIndent(cfg.GenesisState, "", " ")