mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Fix descent from split check (#7105)
This commit is contained in:
@@ -1783,10 +1783,17 @@ pub fn check_block_is_finalized_checkpoint_or_descendant<
|
|||||||
block: B,
|
block: B,
|
||||||
) -> Result<B, BlockError> {
|
) -> Result<B, BlockError> {
|
||||||
// If we have a split block newer than finalization then we also ban blocks which are not
|
// If we have a split block newer than finalization then we also ban blocks which are not
|
||||||
// descended from that split block.
|
// descended from that split block. It's important not to try checking `is_descendant` if
|
||||||
|
// finality is ahead of the split and the split block has been pruned, as `is_descendant` will
|
||||||
|
// return `false` in this case.
|
||||||
|
let finalized_slot = fork_choice
|
||||||
|
.finalized_checkpoint()
|
||||||
|
.epoch
|
||||||
|
.start_slot(T::EthSpec::slots_per_epoch());
|
||||||
let split = chain.store.get_split_info();
|
let split = chain.store.get_split_info();
|
||||||
let is_descendant_from_split_block =
|
let is_descendant_from_split_block = split.slot == 0
|
||||||
split.slot == 0 || fork_choice.is_descendant(split.block_root, block.parent_root());
|
|| split.slot <= finalized_slot
|
||||||
|
|| fork_choice.is_descendant(split.block_root, block.parent_root());
|
||||||
|
|
||||||
if fork_choice.is_finalized_checkpoint_or_descendant(block.parent_root())
|
if fork_choice.is_finalized_checkpoint_or_descendant(block.parent_root())
|
||||||
&& is_descendant_from_split_block
|
&& is_descendant_from_split_block
|
||||||
|
|||||||
Reference in New Issue
Block a user