From ed662566eb487aafa40f488eab9aa2eb02bd7b63 Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Mon, 12 Feb 2018 12:55:22 +0000 Subject: [PATCH] remove genesis of checkTx --- examples/basecoin/app/app.go | 5 ++--- examples/basecoin/app/app_test.go | 7 +++---- examples/basecoin/app/init_baseapp.go | 5 ++--- types/genesis.go | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index 312cda9a78..7abc3f5b7d 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -71,10 +71,9 @@ func NewBasecoinApp(genesisPath string) *BasecoinApp { ByzantineValidators: nil, }) - ctxCheckTx := app.BaseApp.NewContext(true, nil) - ctxDeliverTx := app.BaseApp.NewContext(false, nil) + ctx := app.BaseApp.NewContext(false, nil) // context for DeliverTx - err = app.BaseApp.InitStater(ctxCheckTx, ctxDeliverTx, genesisiDoc.AppState) + err = app.BaseApp.InitStater(ctx, genesisiDoc.AppState) if err != nil { panic(fmt.Errorf("error loading application genesis state: %v", err)) } diff --git a/examples/basecoin/app/app_test.go b/examples/basecoin/app/app_test.go index 9749f4e3cf..edc4deeef2 100644 --- a/examples/basecoin/app/app_test.go +++ b/examples/basecoin/app/app_test.go @@ -65,11 +65,10 @@ func TestSendMsg(t *testing.T) { bytes, err := json.MarshalIndent(&gaccs, "", "\t") app := tba.BasecoinApp - ctxCheckTx := app.BaseApp.NewContext(true, nil) - ctxDeliverTx := app.BaseApp.NewContext(false, nil) - err = app.BaseApp.InitStater(ctxCheckTx, ctxDeliverTx, bytes) + ctx := app.BaseApp.NewContext(false, nil) // context for DeliverTx + err = app.BaseApp.InitStater(ctx, bytes) require.Nil(t, err) - res1 := app.accountMapper.GetAccount(ctxDeliverTx, baseAcc.Address) + res1 := app.accountMapper.GetAccount(ctx, baseAcc.Address) assert.Equal(t, acc, res1) } diff --git a/examples/basecoin/app/init_baseapp.go b/examples/basecoin/app/init_baseapp.go index 7d3a898354..aac14e4a52 100644 --- a/examples/basecoin/app/init_baseapp.go +++ b/examples/basecoin/app/init_baseapp.go @@ -76,7 +76,7 @@ func (ga *GenesisAccount) toAppAccount() (acc *types.AppAccount, err error) { func (app *BasecoinApp) initBaseAppInitStater() { accountMapper := app.accountMapper - app.BaseApp.SetInitStater(func(ctxCheckTx, ctxDeliverTx sdk.Context, state json.RawMessage) sdk.Error { + app.BaseApp.SetInitStater(func(ctx sdk.Context, state json.RawMessage) sdk.Error { if state == nil { return nil } @@ -93,8 +93,7 @@ func (app *BasecoinApp) initBaseAppInitStater() { if err != nil { return sdk.ErrGenesisParse("").TraceCause(err, "") } - accountMapper.SetAccount(ctxCheckTx, acc) - accountMapper.SetAccount(ctxDeliverTx, acc) + accountMapper.SetAccount(ctx, acc) } return nil }) diff --git a/types/genesis.go b/types/genesis.go index 008661f282..643235e3e9 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -3,4 +3,4 @@ package types import "encoding/json" // function variable used to initialize application state at genesis -type InitStater func(ctxCheckTx, ctxDeliverTx Context, state json.RawMessage) Error +type InitStater func(ctx Context, state json.RawMessage) Error