diff --git a/consensus/state.go b/consensus/state.go index 338568b3..d76c8296 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -321,7 +321,10 @@ func (cs *ConsensusState) startRoutines(maxSteps int) { } func (cs *ConsensusState) OnStop() { + cs.mtx.Lock() // NOTE: OnStop prints the cs.Height, which might be concurrently updated ... cs.QuitService.OnStop() + cs.mtx.Unlock() + if cs.wal != nil && cs.IsRunning() { cs.wal.Wait() }