mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-21 06:48:27 +00:00
Store parent_payload_hash in ProtoNode
This commit is contained in:
@@ -143,6 +143,8 @@ pub struct ProtoNode {
|
||||
pub full_payload_weight: u64,
|
||||
#[superstruct(only(V29), partial_getter(copy))]
|
||||
pub execution_payload_block_hash: ExecutionBlockHash,
|
||||
#[superstruct(only(V29), partial_getter(copy))]
|
||||
pub execution_payload_parent_hash: ExecutionBlockHash,
|
||||
/// Equivalent to spec's `block_timeliness[root][ATTESTATION_TIMELINESS_INDEX]`.
|
||||
#[superstruct(only(V29), partial_getter(copy))]
|
||||
pub block_timeliness_attestation_threshold: bool,
|
||||
@@ -181,7 +183,6 @@ pub struct ProtoNode {
|
||||
impl ProtoNode {
|
||||
/// Generic version of spec's `parent_payload_status` that works for pre-Gloas nodes by
|
||||
/// considering their parents Empty.
|
||||
/// Pre-Gloas nodes have no ePBS, default to Empty.
|
||||
pub fn get_parent_payload_status(&self) -> PayloadStatus {
|
||||
self.parent_payload_status().unwrap_or(PayloadStatus::Empty)
|
||||
}
|
||||
@@ -620,6 +621,7 @@ impl ProtoArray {
|
||||
empty_payload_weight: 0,
|
||||
full_payload_weight: 0,
|
||||
execution_payload_block_hash,
|
||||
execution_payload_parent_hash,
|
||||
// Per spec `get_forkchoice_store`: the anchor block's PTC votes are
|
||||
// initialized to all-True, ensuring `is_payload_timely` and
|
||||
// `is_payload_data_available` return true for the anchor.
|
||||
|
||||
@@ -1030,7 +1030,7 @@ impl ProtoArrayForkChoice {
|
||||
.unwrap_or_else(|_| ExecutionStatus::irrelevant()),
|
||||
unrealized_justified_checkpoint: block.unrealized_justified_checkpoint(),
|
||||
unrealized_finalized_checkpoint: block.unrealized_finalized_checkpoint(),
|
||||
execution_payload_parent_hash: None,
|
||||
execution_payload_parent_hash: block.execution_payload_parent_hash().ok(),
|
||||
execution_payload_block_hash: block.execution_payload_block_hash().ok(),
|
||||
proposer_index: block.proposer_index().ok(),
|
||||
})
|
||||
@@ -1047,7 +1047,8 @@ impl ProtoArrayForkChoice {
|
||||
}
|
||||
|
||||
/// Returns whether the execution payload for a block has been received.
|
||||
/// Returns `false` for pre-GLOAS (V17) nodes or unknown blocks.
|
||||
///
|
||||
/// Returns `false` for pre-Gloas (V17) nodes or unknown blocks.
|
||||
pub fn is_payload_received(&self, block_root: &Hash256) -> bool {
|
||||
self.get_proto_node(block_root)
|
||||
.and_then(|node| node.payload_received().ok())
|
||||
|
||||
Reference in New Issue
Block a user