2019-08-27 06:19:26 -07:00
|
|
|
package keeper_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
|
|
"github.com/tendermint/tendermint/libs/log"
|
|
|
|
dbm "github.com/tendermint/tm-db"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
|
|
"github.com/cosmos/cosmos-sdk/simapp"
|
|
|
|
)
|
|
|
|
|
|
|
|
func createTestApp() *simapp.SimApp {
|
|
|
|
db := dbm.NewMemDB()
|
2020-01-03 06:37:29 -08:00
|
|
|
app := simapp.NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, 5)
|
2019-08-27 06:19:26 -07:00
|
|
|
// init chain must be called to stop deliverState from being nil
|
|
|
|
genesisState := simapp.NewDefaultGenesisState()
|
|
|
|
stateBytes, err := codec.MarshalJSONIndent(app.Codec(), genesisState)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize the chain
|
|
|
|
app.InitChain(
|
|
|
|
abci.RequestInitChain{
|
|
|
|
Validators: []abci.ValidatorUpdate{},
|
|
|
|
AppStateBytes: stateBytes,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
app.Commit()
|
|
|
|
app.BeginBlock(abci.RequestBeginBlock{Header: abci.Header{Height: app.LastBlockHeight() + 1}})
|
|
|
|
|
|
|
|
return app
|
|
|
|
}
|