diff --git a/state/execution.go b/state/execution.go index 3ae0a9d33..e03001da2 100644 --- a/state/execution.go +++ b/state/execution.go @@ -54,10 +54,6 @@ func (s *State) ExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnC nextValSet.IncrementAccum(1) s.SetBlockAndValidators(block.Header, blockPartsHeader, valSet, nextValSet) - // save state with updated height/blockhash/validators - // but stale apphash, in case we fail between Commit and Save - s.SaveIntermediate() - fail.Fail() // XXX return nil diff --git a/state/state.go b/state/state.go index f4af8ee01..c4c6d7489 100644 --- a/state/state.go +++ b/state/state.go @@ -14,8 +14,7 @@ import ( ) var ( - stateKey = []byte("stateKey") - stateIntermediateKey = []byte("stateIntermediateKey") + stateKey = []byte("stateKey") ) //----------------------------------------------------------------------------- @@ -82,35 +81,6 @@ func (s *State) Save() { s.db.SetSync(stateKey, s.Bytes()) } -func (s *State) SaveIntermediate() { - s.mtx.Lock() - defer s.mtx.Unlock() - s.db.SetSync(stateIntermediateKey, s.Bytes()) -} - -// Load the intermediate state into the current state -// and do some sanity checks -func (s *State) LoadIntermediate() { - s2 := loadState(s.db, stateIntermediateKey) - if s.ChainID != s2.ChainID { - PanicSanity(Fmt("State mismatch for ChainID. Got %v, Expected %v", s2.ChainID, s.ChainID)) - } - - if s.LastBlockHeight+1 != s2.LastBlockHeight { - PanicSanity(Fmt("State mismatch for LastBlockHeight. Got %v, Expected %v", s2.LastBlockHeight, s.LastBlockHeight+1)) - } - - if !bytes.Equal(s.Validators.Hash(), s2.LastValidators.Hash()) { - PanicSanity(Fmt("State mismatch for LastValidators. Got %X, Expected %X", s2.LastValidators.Hash(), s.Validators.Hash())) - } - - if !bytes.Equal(s.AppHash, s2.AppHash) { - PanicSanity(Fmt("State mismatch for AppHash. Got %X, Expected %X", s2.AppHash, s.AppHash)) - } - - s.setBlockAndValidators(s2.LastBlockHeight, s2.LastBlockID, s2.LastBlockTime, s2.Validators.Copy(), s2.LastValidators.Copy()) -} - func (s *State) Equals(s2 *State) bool { return bytes.Equal(s.Bytes(), s2.Bytes()) }