From 85e83934a10d10f08dfd7bc7f0bd55573fe1c7bb Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Tue, 28 Mar 2017 12:07:32 -0400 Subject: [PATCH] fixes from review --- config/tendermint/config.go | 3 +++ consensus/replay.go | 2 +- consensus/state.go | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/tendermint/config.go b/config/tendermint/config.go index ea2f1d43a..fd9075e3b 100644 --- a/config/tendermint/config.go +++ b/config/tendermint/config.go @@ -79,6 +79,8 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("block_size", 10000) // max number of txs mapConfig.SetDefault("block_part_size", 65536) // part size 64K mapConfig.SetDefault("disable_data_hash", false) + + // all timeouts are in ms mapConfig.SetDefault("timeout_handshake", 10000) mapConfig.SetDefault("timeout_propose", 3000) mapConfig.SetDefault("timeout_propose_delta", 500) @@ -87,6 +89,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("timeout_precommit", 1000) mapConfig.SetDefault("timeout_precommit_delta", 500) mapConfig.SetDefault("timeout_commit", 1000) + // make progress asap (no `timeout_commit`) on full precommit votes mapConfig.SetDefault("skip_timeout_commit", false) mapConfig.SetDefault("mempool_recheck", true) diff --git a/consensus/replay.go b/consensus/replay.go index 4bdc2e870..ff11a390b 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -326,7 +326,6 @@ func (h *Handshaker) replayBlocks(proxyApp proxy.AppConns, appBlockHeight, store func (h *Handshaker) replayLastBlock(proxyApp proxy.AppConnConsensus) ([]byte, error) { mempool := types.MockMempool{} cs := NewConsensusState(h.config, h.state, proxyApp, h.store, mempool) - defer cs.Stop() evsw := types.NewEventSwitch() evsw.Start() @@ -338,6 +337,7 @@ func (h *Handshaker) replayLastBlock(proxyApp proxy.AppConnConsensus) ([]byte, e if _, err := cs.Start(); err != nil { return nil, err } + defer cs.Stop() timeout := h.config.GetInt("timeout_handshake") timer := time.NewTimer(time.Duration(timeout) * time.Millisecond) diff --git a/consensus/state.go b/consensus/state.go index cca9d2ed4..d4c63a681 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -358,8 +358,9 @@ func (cs *ConsensusState) OnStart() error { // we may have lost some votes if the process crashed // reload from consensus log to catchup if err := cs.catchupReplay(cs.Height); err != nil { - log.Error("Error on catchup replay", "error", err.Error()) - // let's go for it anyways, maybe we're fine + log.Error("Error on catchup replay. Proceeding to start ConsensusState anyway", "error", err.Error()) + // NOTE: if we ever do return an error here, + // make sure to stop the timeoutTicker } // now start the receiveRoutine