pub trait Application: Send + Sync {
// Required method
fn on_commit(&self, block: &Block) -> Result<()>;
// Provided methods
fn create_payload(&self) -> Vec<u8> ⓘ { ... }
fn validate_block(&self, _block: &Block) -> bool { ... }
fn validate_tx(&self, _tx: &[u8]) -> bool { ... }
fn begin_block(&self, _height: Height, _view: ViewNumber) -> Result<()> { ... }
fn deliver_tx(&self, _tx: &[u8]) -> Result<()> { ... }
fn end_block(&self, _height: Height) -> Result<()> { ... }
fn query(&self, _path: &str, _data: &[u8]) -> Result<Vec<u8>> { ... }
}Expand description
ABCI-like application interface for the consensus engine.
The lifecycle for each block:
begin_block— called when a new block is being proposeddeliver_tx— called for each transaction in the payloadend_block— called after all transactions are deliveredon_commit— called when the block is finalized in the committed chain
For block validation:
validate_block— full block validation before votingvalidate_tx— individual transaction validation for mempool
Required Methods§
Provided Methods§
Sourcefn create_payload(&self) -> Vec<u8> ⓘ
fn create_payload(&self) -> Vec<u8> ⓘ
Create a payload for a new block proposal. Typically pulls transactions from the mempool.
Sourcefn validate_block(&self, _block: &Block) -> bool
fn validate_block(&self, _block: &Block) -> bool
Validate a proposed block before voting.
Sourcefn validate_tx(&self, _tx: &[u8]) -> bool
fn validate_tx(&self, _tx: &[u8]) -> bool
Validate a single transaction for mempool admission.
Sourcefn begin_block(&self, _height: Height, _view: ViewNumber) -> Result<()>
fn begin_block(&self, _height: Height, _view: ViewNumber) -> Result<()>
Called at the beginning of block execution.
Sourcefn deliver_tx(&self, _tx: &[u8]) -> Result<()>
fn deliver_tx(&self, _tx: &[u8]) -> Result<()>
Called for each transaction in the block payload.