reth_provider

Trait BlockHashReader

pub trait BlockHashReader: Send + Sync {
    // Required methods
    fn block_hash(
        &self,
        number: u64,
    ) -> Result<Option<FixedBytes<32>>, ProviderError>;
    fn canonical_hashes_range(
        &self,
        start: u64,
        end: u64,
    ) -> Result<Vec<FixedBytes<32>>, ProviderError>;

    // Provided method
    fn convert_block_hash(
        &self,
        hash_or_number: HashOrNumber,
    ) -> Result<Option<FixedBytes<32>>, ProviderError> { ... }
}
Expand description

Client trait for fetching block hashes by number.

Required Methods§

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the hash of the block with the given number. Returns None if no block with this number exists.

fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>

Get headers in range of block hashes or numbers

Returns the available hashes of that range.

Note: The range is start..end, so the expected result is [start..end)

Provided Methods§

fn convert_block_hash( &self, hash_or_number: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the hash of the block with the given number. Returns None if no block with this number exists.

Implementations on Foreign Types§

§

impl BlockHashReader for StateProviderTest

§

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>

§

impl<'a, N> BlockHashReader for MemoryOverlayStateProviderRef<'a, N>
where N: NodePrimitives,

§

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>

§

impl<'a, T> BlockHashReader for &'a T
where T: 'a + BlockHashReader + ?Sized, &'a T: Send + Sync,

§

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn convert_block_hash( &self, hash_or_number: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>

§

impl<N> BlockHashReader for MemoryOverlayStateProvider<N>
where N: NodePrimitives,

§

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>

§

impl<T> BlockHashReader for Box<T>
where T: BlockHashReader + ?Sized, Box<T>: Send + Sync,

§

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn convert_block_hash( &self, hash_or_number: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>

§

impl<T> BlockHashReader for Arc<T>
where T: BlockHashReader + ?Sized, Arc<T>: Send + Sync,

§

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn convert_block_hash( &self, hash_or_number: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>

§

fn canonical_hashes_range( &self, start: u64, end: u64, ) -> Result<Vec<FixedBytes<32>>, ProviderError>

Implementors§

Source§

impl BlockHashReader for MockEthProvider

Available on crate feature test-utils only.
Source§

impl BlockHashReader for NoopProvider

Available on crate feature test-utils only.

Noop implementation for testing purposes

Source§

impl<'a, Provider: DBProvider + BlockHashReader> BlockHashReader for LatestStateProvider<Provider>

Source§

impl<'a, Provider: DBProvider + BlockNumReader + BlockHashReader> BlockHashReader for HistoricalStateProvider<Provider>

§

impl<ChainSpec> BlockHashReader for NoopBlockReader<ChainSpec>
where ChainSpec: Send + Sync,

Noop implementation for testing purposes

Source§

impl<N: NodePrimitives> BlockHashReader for StaticFileJarProvider<'_, N>

Source§

impl<N: NodePrimitives> BlockHashReader for StaticFileProvider<N>

Source§

impl<N: ProviderNodeTypes> BlockHashReader for BlockchainProvider2<N>

Source§

impl<N: ProviderNodeTypes> BlockHashReader for BlockchainProvider<N>

Source§

impl<N: ProviderNodeTypes> BlockHashReader for ConsistentProvider<N>

Source§

impl<N: ProviderNodeTypes> BlockHashReader for ProviderFactory<N>

Source§

impl<Provider: BlockHashReader> BlockHashReader for LatestStateProviderRef<'_, Provider>

Source§

impl<Provider: DBProvider + BlockNumReader + BlockHashReader> BlockHashReader for HistoricalStateProviderRef<'_, Provider>

Source§

impl<SP: StateProvider, EDP: ExecutionDataProvider> BlockHashReader for BundleStateProvider<SP, EDP>

Source§

impl<TX: DbTx + 'static, N: NodeTypes> BlockHashReader for DatabaseProvider<TX, N>