diff --git a/app/app.go b/app/app.go index 3c092f9d6f..98fcee879b 100644 --- a/app/app.go +++ b/app/app.go @@ -128,8 +128,9 @@ func (app *Basecoin) Query(query []byte) (res tmsp.Result) { // TMSP::Commit func (app *Basecoin) Commit() (res tmsp.Result) { - // Commit eyes. - res = app.eyesCli.CommitSync() + + // Commit state + res = app.state.Commit() // Wrap the committed state in cache for CheckTx app.cacheState = app.state.CacheWrap() diff --git a/state/state.go b/state/state.go index 901ee68873..eb6fe8ba5c 100644 --- a/state/state.go +++ b/state/state.go @@ -4,6 +4,8 @@ import ( "github.com/tendermint/basecoin/types" . "github.com/tendermint/go-common" "github.com/tendermint/go-wire" + eyes "github.com/tendermint/merkleeyes/client" + tmsp "github.com/tendermint/tmsp/types" ) // CONTRACT: State should be quick to copy. @@ -75,6 +77,11 @@ func (s *State) CacheSync() { s.writeCache.Sync() } +func (s *State) Commit() tmsp.Result { + s.readCache = make(map[string][]byte) + return s.store.(*eyes.Client).CommitSync() +} + //---------------------------------------- func AccountKey(addr []byte) []byte {