Skip to content

Commit ec1271f

Browse files
committed
Remove useless mapNextTx lookup in CTxMemPool::TrimToSize.
Prior to per-utxo CCoins, we checked that no other in-mempool tx spent any of the given transaction's outputs, as we don't want to uncache that entire tx in such a case. However, we now are checking only that there exists no other mempool spends of the same output, which should clearly be impossible after we removed the transaction which was spending said output (barring massive mempool inconsistency). Thanks to @sdaftuar for the suggestion.
1 parent 9fec4da commit ec1271f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/txmempool.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,9 +1050,7 @@ void CTxMemPool::TrimToSize(size_t sizelimit, std::vector<COutPoint>* pvNoSpends
10501050
BOOST_FOREACH(const CTransaction& tx, txn) {
10511051
BOOST_FOREACH(const CTxIn& txin, tx.vin) {
10521052
if (exists(txin.prevout.hash)) continue;
1053-
if (!mapNextTx.count(txin.prevout)) {
1054-
pvNoSpendsRemaining->push_back(txin.prevout);
1055-
}
1053+
pvNoSpendsRemaining->push_back(txin.prevout);
10561054
}
10571055
}
10581056
}

0 commit comments

Comments
 (0)