diff options
| author | Gavin Andresen <[email protected]> | 2014-02-28 15:16:25 -0500 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2014-02-28 15:16:25 -0500 |
| commit | f60e49d49c72908356d70d05ae30c6e63be2192d (patch) | |
| tree | 3fdc2c60417664b6b13005b06085d99472cd250b /src/txmempool.cpp | |
| parent | Merge pull request #3750 from gavinandresen/osx_minversion (diff) | |
| parent | Remove CWalletTx::vfSpent (diff) | |
| download | discoin-f60e49d49c72908356d70d05ae30c6e63be2192d.tar.xz discoin-f60e49d49c72908356d70d05ae30c6e63be2192d.zip | |
Merge pull request #3694 from gavinandresen/vfspent
Remove CWalletTx::vfSpent
Diffstat (limited to 'src/txmempool.cpp')
| -rw-r--r-- | src/txmempool.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index be251d1d6..64c9eac73 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -86,7 +86,7 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry) } -bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive) +void CTxMemPool::remove(const CTransaction &tx, std::list<CTransaction>& removed, bool fRecursive) { // Remove transaction from memory pool { @@ -95,34 +95,37 @@ bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive) if (fRecursive) { for (unsigned int i = 0; i < tx.vout.size(); i++) { std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(hash, i)); - if (it != mapNextTx.end()) - remove(*it->second.ptx, true); + if (it == mapNextTx.end()) + continue; + remove(*it->second.ptx, removed, true); } } if (mapTx.count(hash)) { + removed.push_front(tx); BOOST_FOREACH(const CTxIn& txin, tx.vin) mapNextTx.erase(txin.prevout); mapTx.erase(hash); nTransactionsUpdated++; } } - return true; } -bool CTxMemPool::removeConflicts(const CTransaction &tx) +void CTxMemPool::removeConflicts(const CTransaction &tx, std::list<CTransaction>& removed) { // Remove transactions which depend on inputs of tx, recursively + list<CTransaction> result; LOCK(cs); BOOST_FOREACH(const CTxIn &txin, tx.vin) { std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(txin.prevout); if (it != mapNextTx.end()) { const CTransaction &txConflict = *it->second.ptx; if (txConflict != tx) - remove(txConflict, true); + { + remove(txConflict, removed, true); + } } } - return true; } void CTxMemPool::clear() |