From f7587f784704e0919b67e4b0cd459d855d3c932c Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Fri, 27 Apr 2018 20:47:35 -0400 Subject: [PATCH] export refactor, lcd tests borken --- examples/basecoin/app/app.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index b8f5346cd6..f5122c1307 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -125,14 +125,19 @@ func (app *BasecoinApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) // Custom logic for state export func (app *BasecoinApp) ExportAppStateJSON() (appState json.RawMessage, err error) { ctx := app.NewContext(true, abci.Header{}) + + // iterate to get the accounts accounts := []*types.GenesisAccount{} - app.accountMapper.IterateAccounts(ctx, func(a sdk.Account) bool { - accounts = append(accounts, &types.GenesisAccount{ - Address: a.GetAddress(), - Coins: a.GetCoins(), - }) + appendAccount := func(acc sdk.Account) (stop bool) { + account := &types.GenesisAccount{ + Address: acc.GetAddress(), + Coins: acc.GetCoins(), + } + accounts = append(accounts, account) return false - }) + } + app.accountMapper.IterateAccounts(ctx, appendAccount) + genState := types.GenesisState{ Accounts: accounts, }