Reset readCache upon commit

This commit is contained in:
Jae Kwon 2017-01-12 17:49:51 -08:00
parent 623ef17a84
commit 1c50204470
2 changed files with 10 additions and 2 deletions

View File

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

View File

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