mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-16 02:08:29 +00:00
Use fork choice to ensure that the execution envelope snapshot is populated in most cases
This commit is contained in:
@@ -1276,6 +1276,29 @@ impl ProtoArray {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the latest ancestor of `block_root` whose `PayloadStatus` is `Full`.
|
||||
pub(crate) fn latest_parent_full_block<E: EthSpec>(
|
||||
&self,
|
||||
block_root: Hash256,
|
||||
proposer_boost_root: Hash256,
|
||||
justified_balances: &JustifiedBalances,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<Option<Hash256>, Error> {
|
||||
for node in self.iter_nodes(&block_root) {
|
||||
if self.get_canonical_payload_status::<E>(
|
||||
node.root(),
|
||||
node.slot(),
|
||||
proposer_boost_root,
|
||||
justified_balances,
|
||||
spec,
|
||||
)? == PayloadStatus::Full
|
||||
{
|
||||
return Ok(Some(node.root()));
|
||||
}
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
/// Returns the canonical payload status of a block, matching the decision
|
||||
/// `get_head` would make between `(root, FULL)` and `(root, EMPTY)`.
|
||||
pub(crate) fn get_canonical_payload_status<E: EthSpec>(
|
||||
|
||||
@@ -1083,6 +1083,21 @@ impl ProtoArrayForkChoice {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Returns the latest ancestor of `block_root` whose `PayloadStatus` is `Full`.
|
||||
pub fn latest_parent_full_block<E: EthSpec>(
|
||||
&self,
|
||||
block_root: Hash256,
|
||||
proposer_boost_root: Hash256,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<Option<Hash256>, Error> {
|
||||
self.proto_array.latest_parent_full_block::<E>(
|
||||
block_root,
|
||||
proposer_boost_root,
|
||||
&self.balances,
|
||||
spec,
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns the canonical payload status of a block, matching the decision
|
||||
/// `get_head` would make between `(root, FULL)` and `(root, EMPTY)`.
|
||||
pub fn get_canonical_payload_status<E: EthSpec>(
|
||||
|
||||
Reference in New Issue
Block a user