Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | while (!parentHashes.empty()) { | ||||
if (totalSizeWithAncestors > limitAncestorSize) { | if (totalSizeWithAncestors > limitAncestorSize) { | ||||
errString = strprintf("exceeds ancestor size limit [limit: %u]", | errString = strprintf("exceeds ancestor size limit [limit: %u]", | ||||
limitAncestorSize); | limitAncestorSize); | ||||
return false; | return false; | ||||
} | } | ||||
const setEntries &setMemPoolParents = GetMemPoolParents(stageit); | const setEntries &setMemPoolParents = GetMemPoolParents(stageit); | ||||
for (const txiter &phash : setMemPoolParents) { | for (txiter phash : setMemPoolParents) { | ||||
// If this is a new ancestor, add it. | // If this is a new ancestor, add it. | ||||
if (setAncestors.count(phash) == 0) { | if (setAncestors.count(phash) == 0) { | ||||
parentHashes.insert(phash); | parentHashes.insert(phash); | ||||
} | } | ||||
if (parentHashes.size() + setAncestors.size() + 1 > | if (parentHashes.size() + setAncestors.size() + 1 > | ||||
limitAncestorCount) { | limitAncestorCount) { | ||||
errString = | errString = | ||||
strprintf("too many unconfirmed ancestors [limit: %u]", | strprintf("too many unconfirmed ancestors [limit: %u]", | ||||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | void CTxMemPool::CalculateDescendants(txiter entryit, | ||||
// accounted for in setDescendants already (because those children have | // accounted for in setDescendants already (because those children have | ||||
// either already been walked, or will be walked in this iteration). | // either already been walked, or will be walked in this iteration). | ||||
while (!stage.empty()) { | while (!stage.empty()) { | ||||
txiter it = *stage.begin(); | txiter it = *stage.begin(); | ||||
setDescendants.insert(it); | setDescendants.insert(it); | ||||
stage.erase(it); | stage.erase(it); | ||||
const setEntries &setChildren = GetMemPoolChildren(it); | const setEntries &setChildren = GetMemPoolChildren(it); | ||||
for (const txiter &childiter : setChildren) { | for (txiter childiter : setChildren) { | ||||
if (!setDescendants.count(childiter)) { | if (!setDescendants.count(childiter)) { | ||||
stage.insert(childiter); | stage.insert(childiter); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void CTxMemPool::removeRecursive(const CTransaction &origTx, | void CTxMemPool::removeRecursive(const CTransaction &origTx, | ||||
▲ Show 20 Lines • Show All 516 Lines • ▼ Show 20 Lines | return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + | ||||
memusage::DynamicUsage(mapLinks) + | memusage::DynamicUsage(mapLinks) + | ||||
memusage::DynamicUsage(vTxHashes) + cachedInnerUsage; | memusage::DynamicUsage(vTxHashes) + cachedInnerUsage; | ||||
} | } | ||||
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 (const txiter &it : stage) { | for (txiter it : stage) { | ||||
removeUnchecked(it, reason); | removeUnchecked(it, reason); | ||||
} | } | ||||
} | } | ||||
int CTxMemPool::Expire(int64_t time) { | int CTxMemPool::Expire(int64_t time) { | ||||
LOCK(cs); | LOCK(cs); | ||||
indexed_transaction_set::index<entry_time>::type::iterator it = | indexed_transaction_set::index<entry_time>::type::iterator it = | ||||
mapTx.get<entry_time>().begin(); | mapTx.get<entry_time>().begin(); | ||||
▲ Show 20 Lines • Show All 340 Lines • Show Last 20 Lines |