Skip to content

Commit ba02c30

Browse files
committed
[doc] always CleanupTemporaryCoins after a mempool trim
1 parent e72cb20 commit ba02c30

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/validation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,10 @@ MempoolAcceptResult MemPoolAccept::AcceptSingleTransaction(const CTransactionRef
14701470
// Limit the mempool, if appropriate.
14711471
if (!args.m_package_submission && !args.m_bypass_limits) {
14721472
LimitMempoolSize(m_pool, m_active_chainstate.CoinsTip());
1473+
// If mempool contents change, then the m_view cache is dirty. Given this isn't a package
1474+
// submission, we won't be using the cache anymore, but clear it anyway for clarity.
1475+
CleanupTemporaryCoins();
1476+
14731477
if (!m_pool.exists(ws.m_hash)) {
14741478
// The tx no longer meets our (new) mempool minimum feerate but could be reconsidered in a package.
14751479
ws.m_state.Invalid(TxValidationResult::TX_RECONSIDERABLE, "mempool full");
@@ -1831,6 +1835,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
18311835

18321836
// Make sure we haven't exceeded max mempool size.
18331837
// Package transactions that were submitted to mempool or already in mempool may be evicted.
1838+
// If mempool contents change, then the m_view cache is dirty. It has already been cleared above.
18341839
LimitMempoolSize(m_pool, m_active_chainstate.CoinsTip());
18351840

18361841
for (const auto& tx : package) {

0 commit comments

Comments
 (0)