mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-27 16:05:39 +01:00
[mempool] clear mapDeltas entry if prioritisetransaction sets delta to 0
It's unnecessary to keep the data around, as it doesn't do anything. If prioritisetransaction is called again, we'll make a new entry in mapDeltas. These entries are only deleted when the transaction is mined or conflicted from a block (i.e. not in replacement or eviction), are persisted in mempool.dat, and never expire. If node operators use the RPC to regularly prioritise/de-prioritise transactions, these (meaningless) map entries may hang around forever and take up valuable mempool memory.
This commit is contained in:
@@ -870,8 +870,17 @@ void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeD
|
||||
}
|
||||
++nTransactionsUpdated;
|
||||
}
|
||||
if (delta == 0) {
|
||||
mapDeltas.erase(hash);
|
||||
LogPrintf("PrioritiseTransaction: %s (%sin mempool) delta cleared\n", hash.ToString(), it == mapTx.end() ? "not " : "");
|
||||
} else {
|
||||
LogPrintf("PrioritiseTransaction: %s (%sin mempool) fee += %s, new delta=%s\n",
|
||||
hash.ToString(),
|
||||
it == mapTx.end() ? "not " : "",
|
||||
FormatMoney(nFeeDelta),
|
||||
FormatMoney(delta));
|
||||
}
|
||||
}
|
||||
LogPrintf("PrioritiseTransaction: %s fee += %s\n", hash.ToString(), FormatMoney(nFeeDelta));
|
||||
}
|
||||
|
||||
void CTxMemPool::ApplyDelta(const uint256& hash, CAmount &nFeeDelta) const
|
||||
|
||||
Reference in New Issue
Block a user