Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | if (reason != MemPoolRemovalReason::BLOCK) { | ||||
// BlockConnected notification. | // BlockConnected notification. | ||||
GetMainSignals().TransactionRemovedFromMempool(it->GetSharedTx()); | GetMainSignals().TransactionRemovedFromMempool(it->GetSharedTx()); | ||||
} | } | ||||
for (const CTxIn &txin : it->GetTx().vin) { | for (const CTxIn &txin : it->GetTx().vin) { | ||||
mapNextTx.erase(txin.prevout); | mapNextTx.erase(txin.prevout); | ||||
} | } | ||||
/* add logging because unchecked */ | |||||
RemoveUnbroadcastTx(it->GetTx().GetId(), true); | |||||
if (vTxHashes.size() > 1) { | if (vTxHashes.size() > 1) { | ||||
vTxHashes[it->vTxHashesIdx] = std::move(vTxHashes.back()); | vTxHashes[it->vTxHashesIdx] = std::move(vTxHashes.back()); | ||||
vTxHashes[it->vTxHashesIdx].second->vTxHashesIdx = it->vTxHashesIdx; | vTxHashes[it->vTxHashesIdx].second->vTxHashesIdx = it->vTxHashesIdx; | ||||
vTxHashes.pop_back(); | vTxHashes.pop_back(); | ||||
if (vTxHashes.size() * 2 < vTxHashes.capacity()) { | if (vTxHashes.size() * 2 < vTxHashes.capacity()) { | ||||
vTxHashes.shrink_to_fit(); | vTxHashes.shrink_to_fit(); | ||||
} | } | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 573 Lines • ▼ Show 20 Lines | return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + | ||||
12 * sizeof(void *)) * | 12 * sizeof(void *)) * | ||||
mapTx.size() + | mapTx.size() + | ||||
memusage::DynamicUsage(mapNextTx) + | memusage::DynamicUsage(mapNextTx) + | ||||
memusage::DynamicUsage(mapDeltas) + | memusage::DynamicUsage(mapDeltas) + | ||||
memusage::DynamicUsage(mapLinks) + | memusage::DynamicUsage(mapLinks) + | ||||
memusage::DynamicUsage(vTxHashes) + cachedInnerUsage; | memusage::DynamicUsage(vTxHashes) + cachedInnerUsage; | ||||
} | } | ||||
void CTxMemPool::RemoveUnbroadcastTx(const TxId &txid, const bool unchecked) { | |||||
LOCK(cs); | |||||
if (m_unbroadcast_txids.erase(txid)) { | |||||
LogPrint( | |||||
BCLog::MEMPOOL, "Removed %i from set of unbroadcast txns%s\n", | |||||
txid.GetHex(), | |||||
(unchecked ? " before confirmation that txn was sent out" : "")); | |||||
} | |||||
} | |||||
void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants, | void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants, | ||||
MemPoolRemovalReason reason) { | MemPoolRemovalReason reason) { | ||||
AssertLockHeld(cs); | AssertLockHeld(cs); | ||||
UpdateForRemoveFromMempool(stage, updateDescendants); | UpdateForRemoveFromMempool(stage, updateDescendants); | ||||
for (txiter it : stage) { | for (txiter it : stage) { | ||||
removeUnchecked(it, reason); | removeUnchecked(it, reason); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 369 Lines • Show Last 20 Lines |