From 06e70e4d7db930e9e86df998de3374f891b3b73c Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 20 May 2022 10:35:55 -0400 Subject: [PATCH] update conditional logic in blocksync reactor for extCommit peek --- internal/blocksync/reactor.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/blocksync/reactor.go b/internal/blocksync/reactor.go index 4ea8fb034..60ce1ab1f 100644 --- a/internal/blocksync/reactor.go +++ b/internal/blocksync/reactor.go @@ -545,12 +545,13 @@ func (r *Reactor) poolRoutine(ctx context.Context, stateSynced bool, blockSyncCh // see if there are any blocks to sync first, second, extCommit := r.pool.PeekTwoBlocks() - if first == nil || second == nil || extCommit == nil { - if first != nil && extCommit == nil { - // See https://github.com/tendermint/tendermint/pull/8433#discussion_r866790631 - panic(fmt.Errorf("peeked first block without extended commit at height %d - possible node store corruption", first.Height)) - } - // we need all to sync the first block + if state.ConsensusParams.ABCI.VoteExtensionsEnabled(state.LastBlockHeight+1) && + first != nil && extCommit == nil { + // See https://github.com/tendermint/tendermint/pull/8433#discussion_r866790631 + panic(fmt.Errorf("peeked first block without extended commit at height %d - possible node store corruption", first.Height)) + } else if first == nil || second == nil { + // we need to have fetched two consecutive blocks in order to + // perform blocksync verification continue } else { // try again quickly next loop