Calculates descendants of entry that are not already in setDescendants, and adds to setDescendants. Assumes entryit is already a tx in the mempool and CTxMemPoolEntry::m_children 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 ove
| 599 | // in-mempool descendants of it are already in setDescendants as well, so that we |
| 600 | // can save time by not iterating over those entries. |
| 601 | void CTxMemPool::CalculateDescendants(txiter entryit, setEntries& setDescendants) const |
| 602 | { |
| 603 | setEntries stage; |
| 604 | if (setDescendants.count(entryit) == 0) { |
| 605 | stage.insert(entryit); |
| 606 | } |
| 607 | // Traverse down the children of entry, only adding children that are not |
| 608 | // accounted for in setDescendants already (because those children have either |
| 609 | // already been walked, or will be walked in this iteration). |
| 610 | while (!stage.empty()) { |
| 611 | txiter it = *stage.begin(); |
| 612 | setDescendants.insert(it); |
| 613 | stage.erase(it); |
| 614 | |
| 615 | const CTxMemPoolEntry::Children& children = it->GetMemPoolChildrenConst(); |
| 616 | for (const CTxMemPoolEntry& child : children) { |
| 617 | txiter childiter = mapTx.iterator_to(child); |
| 618 | if (!setDescendants.count(childiter)) { |
| 619 | stage.insert(childiter); |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | void CTxMemPool::removeRecursive(const CTransaction &origTx, MemPoolRemovalReason reason) |
| 626 | { |
no test coverage detected