Add an RPC to get prioritised transactions (also tells you whether the tx is in mempool or not), helping users clean up mapDeltas
manually. When CTxMemPool::PrioritiseTransaction
sets a delta to 0, remove the entry from mapDeltas
.
Motivation / Background
mapDeltas
entries are never removed from mapDeltas except when the tx is mined in a block or conflicted.- Mostly it is a feature to allow
prioritisetransaction
for a tx that isn’t in the mempool {yet, anymore}. A user can may resbumit a tx and it retains its priority, or mark a tx as “definitely accept” before it is seen. - Since #8448,
mapDeltas
is persisted to mempool.dat and loaded on restart. This is also good, otherwise we lose prioritisation on restart. - Note the removal due to block/conflict is only done when
removeForBlock
is called, i.e. when the block is received. If you load a mempool.dat containingmapDeltas
with transactions that were mined already (e.g. the file was saved prior to the last few blocks), you don’t delete them. - Related: #4818 and #6464.
- Mostly it is a feature to allow
- There is no way to query the node for not-in-mempool
mapDeltas
. If you add a priority and forget what the value was, the only way to get that information is to inspect mempool.dat. - Calling
prioritisetransaction
with an inverse value does not remove it frommapDeltas
, it just sets the value to 0. It disappears on a restart (LoadMempool
checks if delta is 0), but that might not happen for a while.
Added together, if a user calls prioritisetransaction
very regularly and not all those transactions get mined/conflicted, mapDeltas
might keep lots of entries of delta=0 around. A user should clean up the not-in-mempool prioritisations, but that’s currently difficult without keeping track of what those txids/amounts are.