pub trait Mempool {
    fn check_tx(&self, check_tx_request: RequestCheckTx) -> ResponseCheckTx;

    fn echo(&self, echo_request: RequestEcho) -> ResponseEcho { ... }
    fn flush(&self, _flush_request: RequestFlush) -> ResponseFlush { ... }
}
Available on crate feature sync-api only.
Expand description

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

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

Provided Methods

Echo a string to test abci client/server implementation.

Signals that messages queued on the client should be flushed to the server.

Implementors