mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 22:38:34 +00:00
When a block comes in whose parent is unkown, queue the block for processing and lookup the parent envelope
This commit is contained in:
@@ -321,6 +321,13 @@ pub enum BlockError {
|
||||
bid_parent_root: Hash256,
|
||||
block_parent_root: Hash256,
|
||||
},
|
||||
/// The parent block is known but its execution payload envelope has not been received yet.
|
||||
///
|
||||
/// ## Peer scoring
|
||||
///
|
||||
/// It's unclear if this block is valid, but it cannot be fully verified without the parent's
|
||||
/// execution payload envelope.
|
||||
ParentEnvelopeUnknown { parent_root: Hash256 },
|
||||
}
|
||||
|
||||
/// Which specific signature(s) are invalid in a SignedBeaconBlock
|
||||
@@ -1939,13 +1946,13 @@ fn load_parent<T: BeaconChainTypes, B: AsBlock<T::EthSpec>>(
|
||||
&& let Ok(parent_bid_block_hash) = parent_block.payload_bid_block_hash()
|
||||
{
|
||||
if block.as_block().is_parent_block_full(parent_bid_block_hash) {
|
||||
// TODO(gloas): loading the envelope here is not very efficient
|
||||
// TODO(gloas): check parent payload existence prior to this point?
|
||||
let envelope = chain.store.get_payload_envelope(&root)?.ok_or_else(|| {
|
||||
BeaconChainError::DBInconsistent(format!(
|
||||
"Missing envelope for parent block {root:?}",
|
||||
))
|
||||
})?;
|
||||
// If the parent's execution payload envelope hasn't arrived yet,
|
||||
// return an unknown parent error so the block gets sent to the
|
||||
// reprocess queue.
|
||||
let envelope = chain
|
||||
.store
|
||||
.get_payload_envelope(&root)?
|
||||
.ok_or(BlockError::ParentEnvelopeUnknown { parent_root: root })?;
|
||||
(StatePayloadStatus::Full, envelope.message.state_root)
|
||||
} else {
|
||||
(StatePayloadStatus::Pending, parent_block.state_root())
|
||||
|
||||
Reference in New Issue
Block a user