aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-08-02 02:47:22 +0200
committerPieter Wuille <pieterw@google.com>2013-08-15 23:53:55 +0200
commitf0784ac470a5541343e7985ceb0cb3c28d9a964e (patch)
treefa24cd824fda9619a3a7519cabc5300bc3891bac /src/main.cpp
parent4323bfeafda4a5e0101710d94b518d41819a2325 (diff)
Fix non-standard disconnected transactions causing mempool orphans
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index e78e055147..4c568245e0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -973,15 +973,15 @@ bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive)
{
LOCK(cs);
uint256 hash = tx.GetHash();
+ 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 (mapTx.count(hash))
{
- 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);
- }
- }
BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapNextTx.erase(txin.prevout);
mapTx.erase(hash);
@@ -2083,7 +2083,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
BOOST_FOREACH(CTransaction& tx, vResurrect) {
// ignore validation errors in resurrected transactions
CValidationState stateDummy;
- mempool.accept(stateDummy, tx, false, NULL);
+ if (!mempool.accept(stateDummy, tx, false, NULL))
+ mempool.remove(tx, true);
}
// Delete redundant memory transactions that are in the connected branch