Skip to main content

SealedBlockRecoveryError

Type Alias SealedBlockRecoveryError 

Source
pub type SealedBlockRecoveryError<B> = BlockRecoveryError<SealedBlock<B>>;
Expand description

Type alias for BlockRecoveryError with a SealedBlock value.

This error type is specifically used when recovering a sealed block fails. It contains the original sealed block that could not be recovered, allowing callers to inspect the problematic block or attempt recovery with different parameters.

§Example

use alloy_consensus::{Block, BlockBody, Header, Signed, TxEnvelope, TxLegacy};
use alloy_primitives::{Signature, B256};
use reth_primitives_traits::{block::error::SealedBlockRecoveryError, SealedBlock};

// Create a simple block for demonstration
let header = Header::default();
let tx = TxLegacy::default();
let signed_tx = Signed::new_unchecked(tx, Signature::test_signature(), B256::ZERO);
let envelope = TxEnvelope::Legacy(signed_tx);
let body = BlockBody { transactions: vec![envelope], ommers: vec![], withdrawals: None };
let block = Block::new(header, body);
let sealed_block = SealedBlock::new_unchecked(block, B256::ZERO);

// Simulate a block recovery operation that fails
let block_recovery_result: Result<(), SealedBlockRecoveryError<_>> =
    Err(SealedBlockRecoveryError::new(sealed_block));

// When block recovery fails, you get the error with the original block
let error = block_recovery_result.unwrap_err();
let failed_block = error.into_inner();
// Now you can inspect the failed block or try recovery again

Aliased Type§

pub struct SealedBlockRecoveryError<B>(pub SealedBlock<B>);

Tuple Fields§

§0: SealedBlock<B>

Layout§

Note: Encountered an error during type layout; the type failed to be normalized.