MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CalculateDescendants

Method CalculateDescendants

src/txmempool.cpp:445–466  ·  view source on GitHub ↗

Calculates descendants of entry that are not already in setDescendants, and adds to setDescendants. Assumes entryit is already a tx in the mempool and setMemPoolChildren is correct for tx and all descendants. Also assumes that if an entry is in setDescendants already, then all in-mempool descendants of it are already in setDescendants as well, so that we can save time by not iterating over those e

Source from the content-addressed store, hash-verified

443// in-mempool descendants of it are already in setDescendants as well, so that we
444// can save time by not iterating over those entries.
445void CTxMemPool::CalculateDescendants(txiter entryit, setEntries& setDescendants) const
446{
447 setEntries stage;
448 if (setDescendants.count(entryit) == 0) {
449 stage.insert(entryit);
450 }
451 // Traverse down the children of entry, only adding children that are not
452 // accounted for in setDescendants already (because those children have either
453 // already been walked, or will be walked in this iteration).
454 while (!stage.empty()) {
455 txiter it = *stage.begin();
456 setDescendants.insert(it);
457 stage.erase(it);
458
459 const setEntries &setChildren = GetMemPoolChildren(it);
460 for (const txiter &childiter : setChildren) {
461 if (!setDescendants.count(childiter)) {
462 stage.insert(childiter);
463 }
464 }
465 }
466}
467
468void CTxMemPool::removeRecursive(const CTransaction &origTx, MemPoolRemovalReason reason)
469{

Callers 3

AcceptToMemoryPoolWorkerFunction · 0.80
getmempooldescendantsFunction · 0.80

Calls 5

countMethod · 0.45
insertMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected