mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-01 03:33:47 +00:00
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:
@@ -78,6 +78,7 @@ pub enum Error<T> {
|
||||
UnrealizedVoteProcessing(state_processing::EpochProcessingError),
|
||||
ValidatorStatuses(BeaconStateError),
|
||||
ChainSpecError(String),
|
||||
DoesNotDescendFromFinalizedCheckpoint,
|
||||
}
|
||||
|
||||
impl<T> From<InvalidAttestation> for Error<T> {
|
||||
@@ -1523,6 +1524,29 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the canonical payload status of a block. See
|
||||
/// `ProtoArrayForkChoice::get_canonical_payload_status`.
|
||||
pub fn get_canonical_payload_status(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<PayloadStatus, Error<T::Error>> {
|
||||
if self.is_finalized_checkpoint_or_descendant(*block_root) {
|
||||
let current_slot = self.fc_store.get_current_slot();
|
||||
let proposer_boost_root = self.fc_store.proposer_boost_root();
|
||||
self.proto_array
|
||||
.get_canonical_payload_status::<E>(
|
||||
block_root,
|
||||
current_slot,
|
||||
proposer_boost_root,
|
||||
spec,
|
||||
)
|
||||
.map_err(Error::ProtoArrayError)
|
||||
} else {
|
||||
Err(Error::DoesNotDescendFromFinalizedCheckpoint)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the weight for the given block root.
|
||||
pub fn get_block_weight(&self, block_root: &Hash256) -> Option<u64> {
|
||||
self.proto_array.get_weight(block_root)
|
||||
|
||||
Reference in New Issue
Block a user