pub trait BlockExecutor: Send {
    // Required methods
    fn committed_block_id(&self) -> Result<HashValue, Error>;
    fn execute_block(
        &self,
        block: (HashValue, Vec<Transaction>),
        parent_block_id: HashValue,
        catch_up_mode: bool
    ) -> Result<StateComputeResult, Error>;
    fn commit_blocks(
        &self,
        block_ids: Vec<HashValue>,
        ledger_info_with_sigs: LedgerInfoWithSignatures
    ) -> Result<(Vec<Transaction>, Vec<ContractEvent>), Error>;
}

Required Methods§

source

fn committed_block_id(&self) -> Result<HashValue, Error>

Get the latest committed block id

source

fn execute_block( &self, block: (HashValue, Vec<Transaction>), parent_block_id: HashValue, catch_up_mode: bool ) -> Result<StateComputeResult, Error>

Executes a block.

source

fn commit_blocks( &self, block_ids: Vec<HashValue>, ledger_info_with_sigs: LedgerInfoWithSignatures ) -> Result<(Vec<Transaction>, Vec<ContractEvent>), Error>

Saves eligible blocks to persistent storage. If we have multiple blocks and not all of them have signatures, we may send them to storage in a few batches. For example, if we have

A <- B <- C <- D <- E

and only C and E have signatures, we will send A, B and C in the first batch, then D and E later in the another batch. Commits a block and all its ancestors in a batch manner.

Returns Ok(Result<Vec<Transaction>, Vec<ContractEvents>) if successful, where Vec<Transaction> is a vector of transactions that were kept from the submitted blocks, and Vec<ContractEvents> is a vector of reconfiguration events in the submitted blocks

Implementors§