Ensure payload envelope streamer always serves canonical envelopes after the split slot (#9085)

Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
This commit is contained in:
Eitan Seri-Levi
2026-04-23 20:32:26 +09:00
committed by GitHub
parent cfc748309f
commit 82dc8b4edc
9 changed files with 533 additions and 36 deletions

View File

@@ -383,11 +383,24 @@ impl<T: BeaconChainTypes> CanonicalHead<T> {
Ok((head, execution_status))
}
// TODO(gloas) just a stub for now, implement this once we have fork choice.
/// Returns true if the payload for this block is canonical according to fork choice
/// Returns an error if the block root doesn't exist in fork choice.
pub fn block_has_canonical_payload(&self, _root: &Hash256) -> Result<bool, Error> {
Ok(true)
/// Returns `true` if the payload for this block is canonical (Full) according to fork choice.
pub fn block_has_canonical_payload(
&self,
root: &Hash256,
spec: &ChainSpec,
) -> Result<bool, Error> {
let cached_head = self.cached_head();
let head_root = cached_head.head_block_root();
let head_payload_status = cached_head.head_payload_status();
if *root == head_root {
return Ok(head_payload_status == PayloadStatus::Full);
}
self.fork_choice_read_lock()
.get_canonical_payload_status(root, spec)
.map(|status| status == PayloadStatus::Full)
.map_err(Error::ForkChoiceError)
}
/// Returns a clone of `self.cached_head`.