Notifies listeners of a transaction leaving mempool.

Synopsis

Declared in <validationinterface.h>

virtual
void
TransactionRemovedFromMempool(
    CTransactionRef const& tx,
    MemPoolRemovalReason reason,
    uint64_t mempool_sequence);

Description

This notification fires for transactions that are removed from the mempool for the following reasons:

  • EXPIRY (expired from mempool after ‐mempoolexpiry hours)

  • SIZELIMIT (removed in size limiting if the mempool exceeds ‐maxmempool megabytes)

  • REORG (removed during a reorg)

  • CONFLICT (removed because it conflicts with in‐block transaction)

  • REPLACED (removed due to RBF replacement)

This does not fire for transactions that are removed from the mempool because they have been included in a block. Any client that is interested in transactions removed from the mempool for inclusion in a block can learn about those transactions from the MempoolTransactionsRemovedForBlock notification.

Transactions that are removed from the mempool because they conflict with a transaction in the new block will have TransactionRemovedFromMempool events fired before the BlockConnected event is fired. If multiple blocks are connected in one step, then the ordering could be:

  • TransactionRemovedFromMempool(tx1 from block A)

  • TransactionRemovedFromMempool(tx2 from block A)

  • TransactionRemovedFromMempool(tx1 from block B)

  • TransactionRemovedFromMempool(tx2 from block B)

  • BlockConnected(A)

  • BlockConnected(B)

Called on a background thread.

Parameters

Name

Description

tx

The transaction removed from the mempool.

reason

Why the transaction was removed.

mempool_sequence

Mempool sequence number at the time of the removal.

Created with MrDocs