mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-01 11:54:40 +00:00
Clean up
This commit is contained in:
@@ -3001,16 +3001,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
}
|
||||
|
||||
let is_envelope_relevant = if let Some(envelope) = block.as_envelope() {
|
||||
// If the envelope is relevant we skip the duplicate import check in
|
||||
// `check_block_relevancy`
|
||||
match check_envelope_relevancy(block.as_block(), envelope, self) {
|
||||
Ok(_) => true,
|
||||
Err(_) => false,
|
||||
}
|
||||
} else {
|
||||
false
|
||||
};
|
||||
// If the envelope is relevant we skip the duplicate import check in
|
||||
// `check_block_relevancy`. A verification error or an already-received payload
|
||||
// both leave the envelope irrelevant.
|
||||
let is_envelope_relevant = block
|
||||
.as_envelope()
|
||||
.and_then(|envelope| {
|
||||
check_envelope_relevancy(block.as_block(), envelope, self).ok()
|
||||
})
|
||||
.unwrap_or(false);
|
||||
|
||||
match check_block_relevancy(block.as_block(), block_root, is_envelope_relevant, self) {
|
||||
// If the block is relevant, add it to the filtered chain segment.
|
||||
|
||||
@@ -1881,7 +1881,7 @@ pub fn check_block_relevancy<T: BeaconChainTypes>(
|
||||
|
||||
// Check if the block is already known. We know it is post-finalization, so it is
|
||||
// sufficient to check the fork choice. This check can optionally be skipped.
|
||||
if skip_import_check
|
||||
if !skip_import_check
|
||||
&& chain
|
||||
.canonical_head
|
||||
.fork_choice_read_lock()
|
||||
|
||||
@@ -293,10 +293,10 @@ pub(crate) fn load_snapshot_from_state_root<T: BeaconChainTypes>(
|
||||
|
||||
/// Performs simple, cheap checks to ensure that the envelope is relevant to be imported.
|
||||
///
|
||||
/// `Ok(block_root` is returned if the envelope passes these checks and should progress with
|
||||
/// verification.
|
||||
/// Returns `Ok(true)` if the envelope passes these checks and should progress with verification,
|
||||
/// or `Ok(false)` if its payload has already been received and is no longer relevant.
|
||||
///
|
||||
/// Returns an error if the envelope is not relevant or if an error occurs during a verification step.
|
||||
/// Returns an error if a verification step fails.
|
||||
pub fn check_envelope_relevancy<T: BeaconChainTypes>(
|
||||
block: &SignedBeaconBlock<T::EthSpec>,
|
||||
signed_envelope: &SignedExecutionPayloadEnvelope<T::EthSpec>,
|
||||
|
||||
Reference in New Issue
Block a user