MCPcopy Create free account
hub / github.com/ElementsProject/elements / removeRecursive

Method removeRecursive

src/txmempool.cpp:625–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

623}
624
625void CTxMemPool::removeRecursive(const CTransaction &origTx, MemPoolRemovalReason reason)
626{
627 // Remove transaction from memory pool
628 AssertLockHeld(cs);
629 setEntries txToRemove;
630 txiter origit = mapTx.find(origTx.GetHash());
631 if (origit != mapTx.end()) {
632 txToRemove.insert(origit);
633 } else {
634 // When recursively removing but origTx isn't in the mempool
635 // be sure to remove any children that are in the pool. This can
636 // happen during chain re-orgs if origTx isn't re-accepted into
637 // the mempool for any reason.
638 for (unsigned int i = 0; i < origTx.vout.size(); i++) {
639 auto it = mapNextTx.find(COutPoint(origTx.GetHash(), i));
640 if (it == mapNextTx.end())
641 continue;
642 txiter nextit = mapTx.find(it->second->GetHash());
643 assert(nextit != mapTx.end());
644 txToRemove.insert(nextit);
645 }
646 }
647 setEntries setAllRemoves;
648 for (txiter it : txToRemove) {
649 CalculateDescendants(it, setAllRemoves);
650 }
651
652 RemoveStaged(setAllRemoves, false, reason);
653}
654
655void CTxMemPool::removeForReorg(CChain& chain, std::function<bool(txiter)> check_final_and_mature)
656{

Callers 6

DisconnectTipMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
TestPackageSelectionMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
FinishFunction · 0.80

Calls 6

findMethod · 0.80
COutPointClass · 0.50
GetHashMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45

Tested by 4

BOOST_AUTO_TEST_CASEFunction · 0.64
TestPackageSelectionMethod · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64
FinishFunction · 0.64