remove genesis of checkTx

This commit is contained in:
rigelrozanski 2018-02-12 12:55:22 +00:00
parent 0bab936d70
commit ed662566eb
4 changed files with 8 additions and 11 deletions

View File

@ -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))
}

View File

@ -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)
}

View File

@ -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
})

View File

@ -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