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
| 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. |
| 445 | void 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 | |
| 468 | void CTxMemPool::removeRecursive(const CTransaction &origTx, MemPoolRemovalReason reason) |
| 469 | { |
no test coverage detected