mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Include head_payload_status in ForkChoiceView comparison
The early exit check in recompute_head_at_slot compared only head_block_root and checkpoints. When on_execution_payload changed the payload status from Empty to Full without changing the head root, the CachedHead was not updated. Add head_payload_status to ForkChoiceView so the change is detected.
This commit is contained in:
@@ -608,6 +608,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
// was last run.
|
// was last run.
|
||||||
let old_view = ForkChoiceView {
|
let old_view = ForkChoiceView {
|
||||||
head_block_root: old_cached_head.head_block_root(),
|
head_block_root: old_cached_head.head_block_root(),
|
||||||
|
head_payload_status: old_cached_head.head_payload_status(),
|
||||||
justified_checkpoint: old_cached_head.justified_checkpoint(),
|
justified_checkpoint: old_cached_head.justified_checkpoint(),
|
||||||
finalized_checkpoint: old_cached_head.finalized_checkpoint(),
|
finalized_checkpoint: old_cached_head.finalized_checkpoint(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ pub struct ForkchoiceUpdateParameters {
|
|||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub struct ForkChoiceView {
|
pub struct ForkChoiceView {
|
||||||
pub head_block_root: Hash256,
|
pub head_block_root: Hash256,
|
||||||
|
pub head_payload_status: PayloadStatus,
|
||||||
pub justified_checkpoint: Checkpoint,
|
pub justified_checkpoint: Checkpoint,
|
||||||
pub finalized_checkpoint: Checkpoint,
|
pub finalized_checkpoint: Checkpoint,
|
||||||
}
|
}
|
||||||
@@ -674,6 +675,7 @@ where
|
|||||||
pub fn cached_fork_choice_view(&self) -> ForkChoiceView {
|
pub fn cached_fork_choice_view(&self) -> ForkChoiceView {
|
||||||
ForkChoiceView {
|
ForkChoiceView {
|
||||||
head_block_root: self.forkchoice_update_parameters.head_root,
|
head_block_root: self.forkchoice_update_parameters.head_root,
|
||||||
|
head_payload_status: self.forkchoice_update_parameters.head_payload_status,
|
||||||
justified_checkpoint: self.justified_checkpoint(),
|
justified_checkpoint: self.justified_checkpoint(),
|
||||||
finalized_checkpoint: self.finalized_checkpoint(),
|
finalized_checkpoint: self.finalized_checkpoint(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1200,11 +1200,8 @@ impl ProtoArray {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Compute once rather than per-child per-level.
|
// Compute once rather than per-child per-level.
|
||||||
let apply_proposer_boost = self.should_apply_proposer_boost::<E>(
|
let apply_proposer_boost =
|
||||||
proposer_boost_root,
|
self.should_apply_proposer_boost::<E>(proposer_boost_root, justified_balances, spec)?;
|
||||||
justified_balances,
|
|
||||||
spec,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let children: Vec<_> = self
|
let children: Vec<_> = self
|
||||||
@@ -1373,9 +1370,7 @@ impl ProtoArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
child_index = current_index;
|
child_index = current_index;
|
||||||
current_index = current
|
current_index = current.parent().ok_or(Error::NodeUnknown(current.root()))?;
|
||||||
.parent()
|
|
||||||
.ok_or(Error::NodeUnknown(current.root()))?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user