reth_storage_api

Trait BlockReader

Source
pub trait BlockReader:
    BlockNumReader
    + HeaderProvider
    + TransactionsProvider
    + ReceiptProvider
    + WithdrawalsProvider
    + Send
    + Sync {
Show 14 methods // Required methods fn find_block_by_hash( &self, hash: B256, source: BlockSource, ) -> ProviderResult<Option<Block>>; fn block(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Block>>; fn pending_block(&self) -> ProviderResult<Option<SealedBlock>>; fn pending_block_with_senders( &self, ) -> ProviderResult<Option<SealedBlockWithSenders>>; fn pending_block_and_receipts( &self, ) -> ProviderResult<Option<(SealedBlock, Vec<Receipt>)>>; fn ommers( &self, id: BlockHashOrNumber, ) -> ProviderResult<Option<Vec<Header>>>; fn block_body_indices( &self, num: u64, ) -> ProviderResult<Option<StoredBlockBodyIndices>>; fn block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<BlockWithSenders>>; fn sealed_block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<SealedBlockWithSenders>>; fn block_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<Block>>; fn block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<BlockWithSenders>>; fn sealed_block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<SealedBlockWithSenders>>; // Provided methods fn block_by_hash(&self, hash: B256) -> ProviderResult<Option<Block>> { ... } fn block_by_number(&self, num: u64) -> ProviderResult<Option<Block>> { ... }
}
Expand description

Api trait for fetching Block related data.

If not requested otherwise, implementers of this trait should prioritize fetching blocks from the database.

Required Methods§

Source

fn find_block_by_hash( &self, hash: B256, source: BlockSource, ) -> ProviderResult<Option<Block>>

Tries to find in the given block source.

Note: this only operates on the hash because the number might be ambiguous.

Returns None if block is not found.

Source

fn block(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Block>>

Returns the block with given id from the database.

Returns None if block is not found.

Source

fn pending_block(&self) -> ProviderResult<Option<SealedBlock>>

Returns the pending block if available

Note: This returns a [SealedBlock] because it’s expected that this is sealed by the provider and the caller does not know the hash.

Source

fn pending_block_with_senders( &self, ) -> ProviderResult<Option<SealedBlockWithSenders>>

Returns the pending block if available

Note: This returns a [SealedBlockWithSenders] because it’s expected that this is sealed by the provider and the caller does not know the hash.

Source

fn pending_block_and_receipts( &self, ) -> ProviderResult<Option<(SealedBlock, Vec<Receipt>)>>

Returns the pending block and receipts if available.

Source

fn ommers(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Vec<Header>>>

Returns the ommers/uncle headers of the given block from the database.

Returns None if block is not found.

Source

fn block_body_indices( &self, num: u64, ) -> ProviderResult<Option<StoredBlockBodyIndices>>

Returns the block body indices with matching number from database.

Returns None if block is not found.

Source

fn block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<BlockWithSenders>>

Returns the block with senders with matching number or hash from database.

Returns the block’s transactions in the requested variant.

Returns None if block is not found.

Source

fn sealed_block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<SealedBlockWithSenders>>

Returns the sealed block with senders with matching number or hash from database.

Returns the block’s transactions in the requested variant.

Returns None if block is not found.

Source

fn block_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<Block>>

Returns all blocks in the given inclusive range.

Note: returns only available blocks

Source

fn block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<BlockWithSenders>>

Returns a range of blocks from the database, along with the senders of each transaction in the blocks.

Source

fn sealed_block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<SealedBlockWithSenders>>

Returns a range of sealed blocks from the database, along with the senders of each transaction in the blocks.

Provided Methods§

Source

fn block_by_hash(&self, hash: B256) -> ProviderResult<Option<Block>>

Returns the block with matching hash from the database.

Returns None if block is not found.

Source

fn block_by_number(&self, num: u64) -> ProviderResult<Option<Block>>

Returns the block with matching number from database.

Returns None if block is not found.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + BlockReader + ?Sized> BlockReader for &'a T

Source§

fn find_block_by_hash( &self, hash: B256, source: BlockSource, ) -> ProviderResult<Option<Block>>

Source§

fn block(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Block>>

Source§

fn pending_block(&self) -> ProviderResult<Option<SealedBlock>>

Source§

fn pending_block_with_senders( &self, ) -> ProviderResult<Option<SealedBlockWithSenders>>

Source§

fn pending_block_and_receipts( &self, ) -> ProviderResult<Option<(SealedBlock, Vec<Receipt>)>>

Source§

fn ommers(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Vec<Header>>>

Source§

fn block_by_hash(&self, hash: B256) -> ProviderResult<Option<Block>>

Source§

fn block_by_number(&self, num: u64) -> ProviderResult<Option<Block>>

Source§

fn block_body_indices( &self, num: u64, ) -> ProviderResult<Option<StoredBlockBodyIndices>>

Source§

fn block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<BlockWithSenders>>

Source§

fn sealed_block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<SealedBlockWithSenders>>

Source§

fn block_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<Block>>

Source§

fn block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<BlockWithSenders>>

Source§

fn sealed_block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<SealedBlockWithSenders>>

Source§

impl<T: BlockReader + ?Sized> BlockReader for Arc<T>

Source§

fn find_block_by_hash( &self, hash: B256, source: BlockSource, ) -> ProviderResult<Option<Block>>

Source§

fn block(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Block>>

Source§

fn pending_block(&self) -> ProviderResult<Option<SealedBlock>>

Source§

fn pending_block_with_senders( &self, ) -> ProviderResult<Option<SealedBlockWithSenders>>

Source§

fn pending_block_and_receipts( &self, ) -> ProviderResult<Option<(SealedBlock, Vec<Receipt>)>>

Source§

fn ommers(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Vec<Header>>>

Source§

fn block_by_hash(&self, hash: B256) -> ProviderResult<Option<Block>>

Source§

fn block_by_number(&self, num: u64) -> ProviderResult<Option<Block>>

Source§

fn block_body_indices( &self, num: u64, ) -> ProviderResult<Option<StoredBlockBodyIndices>>

Source§

fn block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<BlockWithSenders>>

Source§

fn sealed_block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<SealedBlockWithSenders>>

Source§

fn block_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<Block>>

Source§

fn block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<BlockWithSenders>>

Source§

fn sealed_block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<SealedBlockWithSenders>>

Implementors§