HomePhabricator

log: mempool: log removal reason in validation interface

Description

log: mempool: log removal reason in validation interface

Summary:
Currently the exact reason a transaction is removed from the mempool isn't
logged. It is sometimes detectable from context, but adding the reason to
the validation interface logs (where it is already passed) seems like an easy
way to disambiguate.

For example, in the case of mempool expiry, the logs look like this:

[validationinterface.cpp:220] [TransactionRemovedFromMempool] [validation] Enqueuing TransactionRemovedFromMempool: txid=<txid>
[txmempool.cpp:1050] [RemoveUnbroadcastTx] [mempool] Removed <txid> from set of unbroadcast txns before confirmation that txn was sent out
[validationinterface.cpp:220] [operator()] [validation] TransactionRemovedFromMempool: txid=<txid>
[validation.cpp:267] [LimitSize] [mempool] Expired 1 transactions from the memory pool

There is no context-free way to know $txid was evicted on the basis of expiry.
This change will make that case (and probably others) clear.

This is a backport of core#26419
Depends on D16084

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16085

Details

Provenance
James O'Beirne <james.obeirne@pm.me>Authored on Oct 28 2022, 22:59
PiRKCommitted on May 2 2024, 05:59
PiRKPushed on May 2 2024, 05:59
Reviewer
Restricted Project
Differential Revision
D16085: log: mempool: log removal reason in validation interface
Parents
rABC6da983fb5b60: remove MemPoolRemovalReason::REPLACED
Branches
Unknown
Tags
Unknown