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>, Error>;
}Required Methods§
Sourcefn committed_block_id(&self) -> Result<HashValue, Error>
fn committed_block_id(&self) -> Result<HashValue, Error>
Get the latest committed block id
Sourcefn execute_block(
&self,
block: (HashValue, Vec<Transaction>),
parent_block_id: HashValue,
catch_up_mode: bool,
) -> Result<StateComputeResult, Error>
fn execute_block( &self, block: (HashValue, Vec<Transaction>), parent_block_id: HashValue, catch_up_mode: bool, ) -> Result<StateComputeResult, Error>
Executes a block.
Sourcefn commit_blocks(
&self,
block_ids: Vec<HashValue>,
ledger_info_with_sigs: LedgerInfoWithSignatures,
) -> Result<Vec<Transaction>, Error>
fn commit_blocks( &self, block_ids: Vec<HashValue>, ledger_info_with_sigs: LedgerInfoWithSignatures, ) -> Result<Vec<Transaction>, 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 <- Eand 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
the committed transactions so the caller can notify mempool.