From 7206c434d442a12cea9a6d449231759bb8cb1b6e Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Fri, 9 Feb 2018 12:48:11 +0000 Subject: [PATCH] genesis exisiting tests pass --- examples/basecoin/app/init_baseapp.go | 7 +++++-- types/genesis.go | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/basecoin/app/init_baseapp.go b/examples/basecoin/app/init_baseapp.go index 525aa2f67..f0528f98c 100644 --- a/examples/basecoin/app/init_baseapp.go +++ b/examples/basecoin/app/init_baseapp.go @@ -35,11 +35,14 @@ func (app *BasecoinApp) initBaseAppTxDecoder() { func (app *BasecoinApp) initBaseAppInitStater() { accountMapper := app.accountMapper - app.BaseApp.SetInitStater(func(ctxCheckTx, ctxDeliverTx sdk.Context, stateJSON []byte) sdk.Error { + app.BaseApp.SetInitStater(func(ctxCheckTx, ctxDeliverTx sdk.Context, state json.RawMessage) sdk.Error { + if state == nil { + return nil + } var accs []*types.AppAccount - err := json.Unmarshal(stateJSON, &accs) + err := json.Unmarshal(state, &accs) if err != nil { return sdk.ErrGenesisParse("").TraceCause(err, "") } diff --git a/types/genesis.go b/types/genesis.go index 24c311feb..008661f28 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -1,4 +1,6 @@ package types +import "encoding/json" + // function variable used to initialize application state at genesis -type InitStater func(ctxCheckTx, ctxDeliverTx Context, stateJSON []byte) Error +type InitStater func(ctxCheckTx, ctxDeliverTx Context, state json.RawMessage) Error