From 6889f77807c9e4b3037b22f42f68626b52036408 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Thu, 19 May 2022 21:55:51 -0400 Subject: [PATCH] fix additional use of extended commit --- internal/consensus/reactor.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/internal/consensus/reactor.go b/internal/consensus/reactor.go index 501523339..18d5851a4 100644 --- a/internal/consensus/reactor.go +++ b/internal/consensus/reactor.go @@ -798,13 +798,20 @@ func (r *Reactor) gossipVotesRoutine(ctx context.Context, ps *PeerState, voteCh if blockStoreBase > 0 && prs.Height != 0 && rs.Height >= prs.Height+2 && prs.Height >= blockStoreBase { // Load the block's extended commit for prs.Height, which contains precommit // signatures for prs.Height. - if ec := r.state.blockStore.LoadBlockExtendedCommit(prs.Height); ec != nil { - if ok, err := r.pickSendVote(ctx, ps, ec, voteCh); err != nil { - return - } else if ok { - logger.Debug("picked Catchup commit to send", "height", prs.Height) - continue - } + var ec *types.ExtendedCommit + if r.state.state.ConsensusParams.ABCI.VoteExtensionsEnabled(prs.Height) { + ec = r.state.blockStore.LoadBlockExtendedCommit(prs.Height) + } else { + ec = r.state.blockStore.LoadBlockCommit(prs.Height).WrappedExtendedCommit() + } + if ec == nil { + continue + } + if ok, err := r.pickSendVote(ctx, ps, ec, voteCh); err != nil { + return + } else if ok { + logger.Debug("picked Catchup commit to send", "height", prs.Height) + continue } }