Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 1,144 Lines • ▼ Show 20 Lines | void CTxMemPool::trackPackageRemoved(const CFeeRate &rate) { | ||||
AssertLockHeld(cs); | AssertLockHeld(cs); | ||||
if (rate.GetFeePerK() > rollingMinimumFeeRate) { | if (rate.GetFeePerK() > rollingMinimumFeeRate) { | ||||
rollingMinimumFeeRate = rate.GetFeePerK(); | rollingMinimumFeeRate = rate.GetFeePerK(); | ||||
blockSinceLastRollingFeeBump = false; | blockSinceLastRollingFeeBump = false; | ||||
} | } | ||||
} | } | ||||
void CTxMemPool::TrimToSize(size_t sizelimit, | void CTxMemPool::TrimToSize(size_t sizelimit, | ||||
std::vector<uint256> *pvNoSpendsRemaining) { | std::vector<COutPoint> *pvNoSpendsRemaining) { | ||||
LOCK(cs); | LOCK(cs); | ||||
unsigned nTxnRemoved = 0; | unsigned nTxnRemoved = 0; | ||||
CFeeRate maxFeeRateRemoved(0); | CFeeRate maxFeeRateRemoved(0); | ||||
while (!mapTx.empty() && DynamicMemoryUsage() > sizelimit) { | while (!mapTx.empty() && DynamicMemoryUsage() > sizelimit) { | ||||
indexed_transaction_set::index<descendant_score>::type::iterator it = | indexed_transaction_set::index<descendant_score>::type::iterator it = | ||||
mapTx.get<descendant_score>().begin(); | mapTx.get<descendant_score>().begin(); | ||||
Show All 18 Lines | while (!mapTx.empty() && DynamicMemoryUsage() > sizelimit) { | ||||
for (txiter iter : stage) { | for (txiter iter : stage) { | ||||
txn.push_back(iter->GetTx()); | txn.push_back(iter->GetTx()); | ||||
} | } | ||||
} | } | ||||
RemoveStaged(stage, false, MemPoolRemovalReason::SIZELIMIT); | RemoveStaged(stage, false, MemPoolRemovalReason::SIZELIMIT); | ||||
if (pvNoSpendsRemaining) { | if (pvNoSpendsRemaining) { | ||||
for (const CTransaction &tx : txn) { | for (const CTransaction &tx : txn) { | ||||
for (const CTxIn &txin : tx.vin) { | for (const CTxIn &txin : tx.vin) { | ||||
if (exists(txin.prevout.hash)) continue; | if (exists(txin.prevout.hash)) { | ||||
continue; | |||||
} | |||||
auto iter = | auto iter = | ||||
mapNextTx.lower_bound(COutPoint(txin.prevout.hash, 0)); | mapNextTx.lower_bound(COutPoint(txin.prevout.hash, 0)); | ||||
if (iter == mapNextTx.end() || | if (iter == mapNextTx.end() || | ||||
iter->first->hash != txin.prevout.hash) | iter->first->hash != txin.prevout.hash) | ||||
pvNoSpendsRemaining->push_back(txin.prevout.hash); | pvNoSpendsRemaining->push_back(txin.prevout); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (maxFeeRateRemoved > CFeeRate(0)) | if (maxFeeRateRemoved > CFeeRate(0)) | ||||
LogPrint("mempool", | LogPrint("mempool", | ||||
"Removed %u txn, rolling minimum fee bumped to %s\n", | "Removed %u txn, rolling minimum fee bumped to %s\n", | ||||
Show All 10 Lines |