diff options
| author | Suhas Daftuar <[email protected]> | 2015-10-19 12:43:38 -0400 |
|---|---|---|
| committer | Suhas Daftuar <[email protected]> | 2016-03-14 12:11:09 -0400 |
| commit | 5de2baa138cda501038a4558bc169b2cfe5b7d6b (patch) | |
| tree | 09ac5f907ece46db950951e56144caa64db61156 /src/txmempool.cpp | |
| parent | CTxMemPool::removeForBlock now uses RemoveStaged (diff) | |
| download | discoin-5de2baa138cda501038a4558bc169b2cfe5b7d6b.tar.xz discoin-5de2baa138cda501038a4558bc169b2cfe5b7d6b.zip | |
Rename CTxMemPool::remove -> removeRecursive
remove is no longer called non-recursively, so simplify the logic
and eliminate an unnecessary parameter
Diffstat (limited to 'src/txmempool.cpp')
| -rw-r--r-- | src/txmempool.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 01f6c97ae..2d1b78bea 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -461,7 +461,7 @@ void CTxMemPool::CalculateDescendants(txiter entryit, setEntries &setDescendants } } -void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& removed, bool fRecursive) +void CTxMemPool::removeRecursive(const CTransaction &origTx, std::list<CTransaction>& removed) { // Remove transaction from memory pool { @@ -470,8 +470,8 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& rem txiter origit = mapTx.find(origTx.GetHash()); if (origit != mapTx.end()) { txToRemove.insert(origit); - } else if (fRecursive) { - // If recursively removing but origTx isn't in the mempool + } else { + // When recursively removing but origTx isn't in the mempool // be sure to remove any children that are in the pool. This can // happen during chain re-orgs if origTx isn't re-accepted into // the mempool for any reason. @@ -485,12 +485,8 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& rem } } setEntries setAllRemoves; - if (fRecursive) { - BOOST_FOREACH(txiter it, txToRemove) { - CalculateDescendants(it, setAllRemoves); - } - } else { - setAllRemoves.swap(txToRemove); + BOOST_FOREACH(txiter it, txToRemove) { + CalculateDescendants(it, setAllRemoves); } BOOST_FOREACH(txiter it, setAllRemoves) { removed.push_back(it->GetTx()); @@ -524,7 +520,7 @@ void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMem } BOOST_FOREACH(const CTransaction& tx, transactionsToRemove) { list<CTransaction> removed; - remove(tx, removed, true); + removeRecursive(tx, removed); } } @@ -539,7 +535,7 @@ void CTxMemPool::removeConflicts(const CTransaction &tx, std::list<CTransaction> const CTransaction &txConflict = *it->second.ptx; if (txConflict != tx) { - remove(txConflict, removed, true); + removeRecursive(txConflict, removed); ClearPrioritisation(txConflict.GetHash()); } } |