From c00c2b4738dcc4ddf97a2383b7effc1dcc138ac4 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Thu, 23 Sep 2021 18:30:10 -0400 Subject: [PATCH] fix prevote nil condition --- internal/consensus/state.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/consensus/state.go b/internal/consensus/state.go index 2046fb4d6..2b705c134 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -1319,6 +1319,13 @@ func (cs *State) defaultDoPrevote(height int64, round int32) { return } + // If a block is locked and it does not match the proposal, prevote nil. + if cs.LockedBlock != nil && !cs.LockedBlock.HashesTo(cs.ProposalBlock.Hash()) { + logger.Debug("prevote step; already locked on a block that does not match proposal; prevoting nil") + cs.signAddVote(tmproto.PrevoteType, nil, types.PartSetHeader{}) + return + } + // Prevote cs.ProposalBlock // NOTE: the proposal signature is validated when it is received, // and the proposal block parts are validated as they are received (against the merkle hash in the proposal)