Browse Source

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.
0.15
Matt Corallo 8 years ago
parent
commit
ec1271f2be
  1. 2
      src/txmempool.cpp

2
src/txmempool.cpp

@ -1050,13 +1050,11 @@ void CTxMemPool::TrimToSize(size_t sizelimit, std::vector<COutPoint>* pvNoSpends
BOOST_FOREACH(const CTransaction& tx, txn) { BOOST_FOREACH(const CTransaction& tx, txn) {
BOOST_FOREACH(const CTxIn& txin, tx.vin) { BOOST_FOREACH(const CTxIn& txin, tx.vin) {
if (exists(txin.prevout.hash)) continue; if (exists(txin.prevout.hash)) continue;
if (!mapNextTx.count(txin.prevout)) {
pvNoSpendsRemaining->push_back(txin.prevout); pvNoSpendsRemaining->push_back(txin.prevout);
} }
} }
} }
} }
}
if (maxFeeRateRemoved > CFeeRate(0)) { if (maxFeeRateRemoved > CFeeRate(0)) {
LogPrint(BCLog::MEMPOOL, "Removed %u txn, rolling minimum fee bumped to %s\n", nTxnRemoved, maxFeeRateRemoved.ToString()); LogPrint(BCLog::MEMPOOL, "Removed %u txn, rolling minimum fee bumped to %s\n", nTxnRemoved, maxFeeRateRemoved.ToString());

Loading…
Cancel
Save