reth::providers

Trait BlockWriter

source
pub trait BlockWriter: Send + Sync {
    // Required methods
    fn insert_block(
        &self,
        block: SealedBlockWithSenders,
    ) -> Result<StoredBlockBodyIndices, ProviderError>;
    fn append_blocks_with_state(
        &self,
        blocks: Vec<SealedBlockWithSenders>,
        execution_outcome: ExecutionOutcome,
        hashed_state: HashedPostStateSorted,
        trie_updates: TrieUpdates,
    ) -> Result<(), ProviderError>;
}
Expand description

Block Writer

Required Methods§

source

fn insert_block( &self, block: SealedBlockWithSenders, ) -> Result<StoredBlockBodyIndices, ProviderError>

Insert full block and make it canonical. Parent tx num and transition id is taken from parent block in database.

Return [StoredBlockBodyIndices] that contains indices of the first and last transactions and transition in the block.

source

fn append_blocks_with_state( &self, blocks: Vec<SealedBlockWithSenders>, execution_outcome: ExecutionOutcome, hashed_state: HashedPostStateSorted, trie_updates: TrieUpdates, ) -> Result<(), ProviderError>

Appends a batch of sealed blocks to the blockchain, including sender information, and updates the post-state.

Inserts the blocks into the database and updates the state with provided BundleState.

§Parameters
  • blocks: Vector of SealedBlockWithSenders instances to append.
  • state: Post-state information to update after appending.
§Returns

Returns Ok(()) on success, or an error if any operation fails.

Implementations on Foreign Types§

source§

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

source§

fn insert_block( &self, block: SealedBlockWithSenders, ) -> Result<StoredBlockBodyIndices, ProviderError>

source§

fn append_blocks_with_state( &self, blocks: Vec<SealedBlockWithSenders>, execution_outcome: ExecutionOutcome, hashed_state: HashedPostStateSorted, trie_updates: TrieUpdates, ) -> Result<(), ProviderError>

source§

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

source§

fn insert_block( &self, block: SealedBlockWithSenders, ) -> Result<StoredBlockBodyIndices, ProviderError>

source§

fn append_blocks_with_state( &self, blocks: Vec<SealedBlockWithSenders>, execution_outcome: ExecutionOutcome, hashed_state: HashedPostStateSorted, trie_updates: TrieUpdates, ) -> Result<(), ProviderError>

source§

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

source§

fn insert_block( &self, block: SealedBlockWithSenders, ) -> Result<StoredBlockBodyIndices, ProviderError>

source§

fn append_blocks_with_state( &self, blocks: Vec<SealedBlockWithSenders>, execution_outcome: ExecutionOutcome, hashed_state: HashedPostStateSorted, trie_updates: TrieUpdates, ) -> Result<(), ProviderError>

Implementors§

source§

impl<TX, Spec> BlockWriter for DatabaseProvider<TX, Spec>
where TX: DbTxMut + DbTx + 'static, Spec: Send + Sync + EthereumHardforks + 'static,