From 7f85fc250a2ae70af35f7bf4dcdb8973d285ea09 Mon Sep 17 00:00:00 2001 From: William Banfield <4561443+williambanfield@users.noreply.github.com> Date: Tue, 8 Mar 2022 20:53:42 -0500 Subject: [PATCH] consensus: start the timeout ticker before replay (#7844) (#8082) --- internal/consensus/state.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/consensus/state.go b/internal/consensus/state.go index 3632957f2..2a8fa392b 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -343,6 +343,15 @@ func (cs *State) OnStart() error { } } + // we need the timeoutRoutine for replay so + // we don't block on the tick chan. + // NOTE: we will get a build up of garbage go routines + // firing on the tockChan until the receiveRoutine is started + // to deal with them (by that point, at most one will be valid) + if err := cs.timeoutTicker.Start(); err != nil { + return err + } + // We may have lost some votes if the process crashed reload from consensus // log to catchup. if cs.doWALCatchup { @@ -399,15 +408,6 @@ func (cs *State) OnStart() error { return err } - // we need the timeoutRoutine for replay so - // we don't block on the tick chan. - // NOTE: we will get a build up of garbage go routines - // firing on the tockChan until the receiveRoutine is started - // to deal with them (by that point, at most one will be valid) - if err := cs.timeoutTicker.Start(); err != nil { - return err - } - // Double Signing Risk Reduction if err := cs.checkDoubleSigningRisk(cs.Height); err != nil { return err