File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
beacon_node/beacon_chain/src Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1783,10 +1783,17 @@ pub fn check_block_is_finalized_checkpoint_or_descendant<
1783
1783
block : B ,
1784
1784
) -> Result < B , BlockError > {
1785
1785
// 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 ( ) ) ;
1787
1793
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 ( ) ) ;
1790
1797
1791
1798
if fork_choice. is_finalized_checkpoint_or_descendant ( block. parent_root ( ) )
1792
1799
&& is_descendant_from_split_block
You can’t perform that action at this time.
0 commit comments