[][src]Trait abci::Mempool

pub trait Mempool: Send + Sync {
    fn check_tx<'life0, 'async_trait>(
        &'life0 self,
        check_tx_request: CheckTxRequest
    ) -> Pin<Box<dyn Future<Output = Result<CheckTxResponse>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

Trait for managing tendermint's mempool.

Details

Mempool should maintain a mempool_state to sequentially process pending transactions in the mempool that have not yet been committed. It should be initialized to the latest committed state at the end of every commit.

The mempool_state may be updated concurrently with the consensus_state, as messages may be sent concurrently on Consensus and Mempool connections. However, before calling commit, Tendermint will lock and flush the mempool connection, ensuring that all existing check_tx are responded to and no new ones can begin.

After commit, check_tx is run again on all transactions that remain in the node's local mempool after filtering those included in the block. To prevent the mempool from rechecking all transactions every time a block is committed, set the configuration option mempool.recheck=false.

Finally, the mempool will unlock and new transactions can be processed through check_tx again.

Note that check_tx doesn't have to check everything that affects transaction validity; the expensive things can be skipped. In fact, check_tx doesn't have to check anything; it might say that any transaction is a valid transaction. Unlike deliver_tx, check_tx is just there as a sort of weak filter to keep invalid transactions out of the blockchain. It's weak, because a Byzantine node doesn't care about check_tx; it can propose a block full of invalid transactions if it wants.

Required methods

fn check_tx<'life0, 'async_trait>(
    &'life0 self,
    check_tx_request: CheckTxRequest
) -> Pin<Box<dyn Future<Output = Result<CheckTxResponse>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Guardian of the mempool: every node runs CheckTx before letting a transaction into its local mempool. Technically optional - not involved in processing blocks

Loading content...

Implementors

Loading content...