pub trait Mempool: Send + Sync {
fn check_tx<'life0, 'async_trait>(
&'life0 self,
check_tx_request: RequestCheckTx
) -> Pin<Box<dyn Future<Output = ResponseCheckTx> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn echo<'life0, 'async_trait>(
&'life0 self,
echo_request: RequestEcho
) -> Pin<Box<dyn Future<Output = ResponseEcho> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn flush<'life0, 'async_trait>(
&'life0 self,
_flush_request: RequestFlush
) -> Pin<Box<dyn Future<Output = ResponseFlush> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
}
async-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
sourcefn check_tx<'life0, 'async_trait>(
&'life0 self,
check_tx_request: RequestCheckTx
) -> Pin<Box<dyn Future<Output = ResponseCheckTx> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn check_tx<'life0, 'async_trait>(
&'life0 self,
check_tx_request: RequestCheckTx
) -> Pin<Box<dyn Future<Output = ResponseCheckTx> + 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
Equivalent to
async fn check_tx(&self, check_tx_request: RequestCheckTx) -> ResponseCheckTx
Provided Methods
sourcefn echo<'life0, 'async_trait>(
&'life0 self,
echo_request: RequestEcho
) -> Pin<Box<dyn Future<Output = ResponseEcho> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn echo<'life0, 'async_trait>(
&'life0 self,
echo_request: RequestEcho
) -> Pin<Box<dyn Future<Output = ResponseEcho> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Echo a string to test abci client/server implementation.
Equivalent to
async fn echo(&self, echo_request: RequestEcho) -> ResponseEcho
sourcefn flush<'life0, 'async_trait>(
&'life0 self,
_flush_request: RequestFlush
) -> Pin<Box<dyn Future<Output = ResponseFlush> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self,
_flush_request: RequestFlush
) -> Pin<Box<dyn Future<Output = ResponseFlush> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Signals that messages queued on the client should be flushed to the server.
Equivalent to
async fn flush(&self, flush_request: RequestFlush) -> ResponseFlush