From 44d472ddd3e5c7048deeb5022533abc28bc2c799 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 18 Feb 2017 22:15:59 -0500 Subject: [PATCH] comments from review --- consensus/state.go | 1 + state/execution.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/consensus/state.go b/consensus/state.go index a985fd2c8..1c864c6d1 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -259,6 +259,7 @@ func ReplayLastBlock(config cfg.Config, state *sm.State, proxyApp proxy.AppConnC evsw := types.NewEventSwitch() evsw.Start() + defer evsw.Stop() cs.SetEventSwitch(evsw) newBlockCh := subscribeToEvent(evsw, "consensus-replay", types.EventStringNewBlock(), 1) diff --git a/state/execution.go b/state/execution.go index e03001da2..71c2dd759 100644 --- a/state/execution.go +++ b/state/execution.go @@ -269,8 +269,8 @@ func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, bl return nil } -// apply a nd commit a block, but with out all the state validation -// returns the application root hash (result of abci.Commit) +// Apply and commit a block, but without all the state validation. +// Returns the application root hash (result of abci.Commit) func applyBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block) ([]byte, error) { var eventCache types.Fireable // nil _, err := execBlockOnProxyApp(eventCache, appConnConsensus, block) @@ -420,7 +420,9 @@ func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight int, proxyApp p } } + // TODO: should we be playing the final block through the consensus, instead of using applyBlock? // h.replayLastBlock(h.config, h.state, proxyApp.Consensus(), h.store) + if !bytes.Equal(h.state.AppHash, appHash) { return errors.New(Fmt("Tendermint state.AppHash does not match AppHash after replay. Got %X, expected %X", appHash, h.state.AppHash)) }