Skip an already finalized block in a segment (#1041)
This commit is contained in:
parent
2469bde6b1
commit
aacec7a4a7
@ -1444,6 +1444,20 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
Err(BlockError::BlockIsAlreadyKnown) => continue,
|
Err(BlockError::BlockIsAlreadyKnown) => continue,
|
||||||
// If the block is the genesis block, simply ignore this block.
|
// If the block is the genesis block, simply ignore this block.
|
||||||
Err(BlockError::GenesisBlock) => continue,
|
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
|
// If there was an error whilst determining if the block was invalid, return that
|
||||||
// error.
|
// error.
|
||||||
Err(BlockError::BeaconChainError(e)) => {
|
Err(BlockError::BeaconChainError(e)) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user