MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / removeRecursive

Method removeRecursive

src/txmempool.cpp:494–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494void CTxMemPool::removeRecursive(const CTransaction &origTx, std::list<CTransaction>& removed)
495{
496 // Remove transaction from memory pool
497 {
498 LOCK(cs);
499 setEntries txToRemove;
500 txiter origit = mapTx.find(origTx.GetHash());
501 if (origit != mapTx.end()) {
502 txToRemove.insert(origit);
503 } else {
504 // When recursively removing but origTx isn't in the mempool
505 // be sure to remove any children that are in the pool. This can
506 // happen during chain re-orgs if origTx isn't re-accepted into
507 // the mempool for any reason.
508 for (unsigned int i = 0; i < origTx.vout.size(); i++) {
509 std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(origTx.GetHash(), i));
510 if (it == mapNextTx.end())
511 continue;
512 txiter nextit = mapTx.find(it->second.ptx->GetHash());
513 assert(nextit != mapTx.end());
514 txToRemove.insert(nextit);
515 }
516 }
517 setEntries setAllRemoves;
518 BOOST_FOREACH(txiter it, txToRemove) {
519 CalculateDescendants(it, setAllRemoves);
520 }
521 BOOST_FOREACH(txiter it, setAllRemoves) {
522 removed.push_back(it->GetTx());
523 }
524 RemoveStaged(setAllRemoves, false);
525 }
526}
527
528void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags)
529{

Callers 2

BOOST_FOREACHFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 6

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

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64