Skip to content

Commit 3645d57

Browse files
Fix descent from split check (#7105)
1 parent 9bb0e13 commit 3645d57

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

beacon_node/beacon_chain/src/block_verification.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,10 +1783,17 @@ pub fn check_block_is_finalized_checkpoint_or_descendant<
17831783
block: B,
17841784
) -> Result<B, BlockError> {
17851785
// If we have a split block newer than finalization then we also ban blocks which are not
1786-
// descended from that split block.
1786+
// descended from that split block. It's important not to try checking `is_descendant` if
1787+
// finality is ahead of the split and the split block has been pruned, as `is_descendant` will
1788+
// return `false` in this case.
1789+
let finalized_slot = fork_choice
1790+
.finalized_checkpoint()
1791+
.epoch
1792+
.start_slot(T::EthSpec::slots_per_epoch());
17871793
let split = chain.store.get_split_info();
1788-
let is_descendant_from_split_block =
1789-
split.slot == 0 || fork_choice.is_descendant(split.block_root, block.parent_root());
1794+
let is_descendant_from_split_block = split.slot == 0
1795+
|| split.slot <= finalized_slot
1796+
|| fork_choice.is_descendant(split.block_root, block.parent_root());
17901797

17911798
if fork_choice.is_finalized_checkpoint_or_descendant(block.parent_root())
17921799
&& is_descendant_from_split_block

0 commit comments

Comments
 (0)