|
|
@ -438,6 +438,9 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, |
|
|
|
totalTxSize += entry.GetTxSize(); |
|
|
|
totalTxSize += entry.GetTxSize(); |
|
|
|
minerPolicyEstimator->processTransaction(entry, fCurrentEstimate); |
|
|
|
minerPolicyEstimator->processTransaction(entry, fCurrentEstimate); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vTxHashes.emplace_back(hash, newit); |
|
|
|
|
|
|
|
newit->vTxHashesIdx = vTxHashes.size() - 1; |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -447,6 +450,15 @@ void CTxMemPool::removeUnchecked(txiter it) |
|
|
|
BOOST_FOREACH(const CTxIn& txin, it->GetTx().vin) |
|
|
|
BOOST_FOREACH(const CTxIn& txin, it->GetTx().vin) |
|
|
|
mapNextTx.erase(txin.prevout); |
|
|
|
mapNextTx.erase(txin.prevout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (vTxHashes.size() > 1) { |
|
|
|
|
|
|
|
vTxHashes[it->vTxHashesIdx] = std::move(vTxHashes.back()); |
|
|
|
|
|
|
|
vTxHashes[it->vTxHashesIdx].second->vTxHashesIdx = it->vTxHashesIdx; |
|
|
|
|
|
|
|
vTxHashes.pop_back(); |
|
|
|
|
|
|
|
if (vTxHashes.size() * 2 < vTxHashes.capacity()) |
|
|
|
|
|
|
|
vTxHashes.shrink_to_fit(); |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
vTxHashes.clear(); |
|
|
|
|
|
|
|
|
|
|
|
totalTxSize -= it->GetTxSize(); |
|
|
|
totalTxSize -= it->GetTxSize(); |
|
|
|
cachedInnerUsage -= it->DynamicMemoryUsage(); |
|
|
|
cachedInnerUsage -= it->DynamicMemoryUsage(); |
|
|
|
cachedInnerUsage -= memusage::DynamicUsage(mapLinks[it].parents) + memusage::DynamicUsage(mapLinks[it].children); |
|
|
|
cachedInnerUsage -= memusage::DynamicUsage(mapLinks[it].parents) + memusage::DynamicUsage(mapLinks[it].children); |
|
|
@ -965,7 +977,7 @@ bool CCoinsViewMemPool::HaveCoins(const uint256 &txid) const { |
|
|
|
size_t CTxMemPool::DynamicMemoryUsage() const { |
|
|
|
size_t CTxMemPool::DynamicMemoryUsage() const { |
|
|
|
LOCK(cs); |
|
|
|
LOCK(cs); |
|
|
|
// Estimate the overhead of mapTx to be 15 pointers + an allocation, as no exact formula for boost::multi_index_contained is implemented.
|
|
|
|
// Estimate the overhead of mapTx to be 15 pointers + an allocation, as no exact formula for boost::multi_index_contained is implemented.
|
|
|
|
return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + 15 * sizeof(void*)) * mapTx.size() + memusage::DynamicUsage(mapNextTx) + memusage::DynamicUsage(mapDeltas) + memusage::DynamicUsage(mapLinks) + cachedInnerUsage; |
|
|
|
return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + 15 * sizeof(void*)) * mapTx.size() + memusage::DynamicUsage(mapNextTx) + memusage::DynamicUsage(mapDeltas) + memusage::DynamicUsage(mapLinks) + memusage::DynamicUsage(vTxHashes) + cachedInnerUsage; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants) { |
|
|
|
void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants) { |
|
|
|