diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 0d8bbb824..e76bd8daf 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -1444,6 +1444,20 @@ impl BeaconChain { Err(BlockError::BlockIsAlreadyKnown) => continue, // If the block is the genesis block, simply ignore this block. Err(BlockError::GenesisBlock) => continue, + // If the block is is for a finalized slot, simply ignore this block. + // + // The block is either: + // + // 1. In the canonical finalized chain. + // 2. In some non-canonical chain at a slot that has been finalized already. + // + // In the case of (1), there's no need to re-import and later blocks in this + // segement might be useful. + // + // In the case of (2), skipping the block is valid since we should never import it. + // However, we will potentially get a `ParentUnknown` on a later block. The sync + // protocol will need to ensure this is handled gracefully. + Err(BlockError::WouldRevertFinalizedSlot { .. }) => continue, // If there was an error whilst determining if the block was invalid, return that // error. Err(BlockError::BeaconChainError(e)) => {