mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-02 12:24:29 +00:00
Re-do head_payload_status
This commit is contained in:
@@ -108,6 +108,8 @@ pub struct CachedHead<E: EthSpec> {
|
||||
/// This value may be distinct to the `self.snapshot.beacon_state.finalized_checkpoint`.
|
||||
/// This value should be used over the beacon state value in practically all circumstances.
|
||||
finalized_checkpoint: Checkpoint,
|
||||
/// The payload status of the head block, as determined by fork choice.
|
||||
head_payload_status: proto_array::PayloadStatus,
|
||||
/// The `execution_payload.block_hash` of the block at the head of the chain. Set to `None`
|
||||
/// before Bellatrix.
|
||||
head_hash: Option<ExecutionBlockHash>,
|
||||
@@ -227,11 +229,16 @@ impl<E: EthSpec> CachedHead<E> {
|
||||
pub fn forkchoice_update_parameters(&self) -> ForkchoiceUpdateParameters {
|
||||
ForkchoiceUpdateParameters {
|
||||
head_root: self.snapshot.beacon_block_root,
|
||||
head_payload_status: self.head_payload_status,
|
||||
head_hash: self.head_hash,
|
||||
justified_hash: self.justified_hash,
|
||||
finalized_hash: self.finalized_hash,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn head_payload_status(&self) -> proto_array::PayloadStatus {
|
||||
self.head_payload_status
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents the "canonical head" of the beacon chain.
|
||||
@@ -269,6 +276,7 @@ impl<T: BeaconChainTypes> CanonicalHead<T> {
|
||||
snapshot,
|
||||
justified_checkpoint: fork_choice_view.justified_checkpoint,
|
||||
finalized_checkpoint: fork_choice_view.finalized_checkpoint,
|
||||
head_payload_status: forkchoice_update_params.head_payload_status,
|
||||
head_hash: forkchoice_update_params.head_hash,
|
||||
justified_hash: forkchoice_update_params.justified_hash,
|
||||
finalized_hash: forkchoice_update_params.finalized_hash,
|
||||
@@ -329,6 +337,7 @@ impl<T: BeaconChainTypes> CanonicalHead<T> {
|
||||
snapshot: Arc::new(snapshot),
|
||||
justified_checkpoint: fork_choice_view.justified_checkpoint,
|
||||
finalized_checkpoint: fork_choice_view.finalized_checkpoint,
|
||||
head_payload_status: forkchoice_update_params.head_payload_status,
|
||||
head_hash: forkchoice_update_params.head_hash,
|
||||
justified_hash: forkchoice_update_params.justified_hash,
|
||||
finalized_hash: forkchoice_update_params.finalized_hash,
|
||||
@@ -606,7 +615,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
let mut fork_choice_write_lock = self.canonical_head.fork_choice_write_lock();
|
||||
|
||||
// Recompute the current head via the fork choice algorithm.
|
||||
fork_choice_write_lock.get_head(current_slot, &self.spec)?;
|
||||
let _ = fork_choice_write_lock.get_head(current_slot, &self.spec)?;
|
||||
|
||||
// Downgrade the fork choice write-lock to a read lock, without allowing access to any
|
||||
// other writers.
|
||||
@@ -710,6 +719,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
snapshot: Arc::new(new_snapshot),
|
||||
justified_checkpoint: new_view.justified_checkpoint,
|
||||
finalized_checkpoint: new_view.finalized_checkpoint,
|
||||
head_payload_status: new_forkchoice_update_parameters.head_payload_status,
|
||||
head_hash: new_forkchoice_update_parameters.head_hash,
|
||||
justified_hash: new_forkchoice_update_parameters.justified_hash,
|
||||
finalized_hash: new_forkchoice_update_parameters.finalized_hash,
|
||||
@@ -737,6 +747,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
snapshot: old_cached_head.snapshot.clone(),
|
||||
justified_checkpoint: new_view.justified_checkpoint,
|
||||
finalized_checkpoint: new_view.finalized_checkpoint,
|
||||
head_payload_status: new_forkchoice_update_parameters.head_payload_status,
|
||||
head_hash: new_forkchoice_update_parameters.head_hash,
|
||||
justified_hash: new_forkchoice_update_parameters.justified_hash,
|
||||
finalized_hash: new_forkchoice_update_parameters.finalized_hash,
|
||||
|
||||
Reference in New Issue
Block a user