Permalink
Browse files

Remove dead transaction replacement code

Should go with 019af93
  • Loading branch information...
Tranz5 committed Aug 23, 2014
1 parent ebafde9 commit 739b66062630c717058caf3c0137d548534fd68c
Showing with 1 addition and 28 deletions.
  1. +1 −28 src/main.cpp
View
@@ -688,7 +688,6 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CTransaction &tx,
return false;
// Check for conflicts with in-memory transactions
CTransaction* ptxOld = NULL;
{
LOCK(pool.cs); // protect pool.mapNextTx
for (unsigned int i = 0; i < tx.vin.size(); i++)
@@ -698,22 +697,6 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CTransaction &tx,
{
// Disable replacement feature for now
return false;
// Allow replacing with a newer version of the same transaction
if (i != 0)
return false;
ptxOld = pool.mapNextTx[outpoint].ptx;
if (IsFinalTx(*ptxOld))
return false;
if (!tx.IsNewerThan(*ptxOld))
return false;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
COutPoint outpoint = tx.vin[i].prevout;
if (!pool.mapNextTx.count(outpoint) || pool.mapNextTx[outpoint].ptx != ptxOld)
return false;
}
break;
}
}
}
@@ -789,24 +772,14 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CTransaction &tx,
}
// Store transaction in memory
if (ptxOld)
{
printf("AcceptToMemoryPool : replacing tx %s with new version\n", ptxOld->GetHash().ToString().c_str());
pool.remove(*ptxOld);
}
pool.addUnchecked(hash, tx);
///// are we sure this is ok when loading transactions or restoring block txes
// If updated, erase old tx from wallet
if (ptxOld)
EraseFromWallets(ptxOld->GetHash());
SyncWithWallets(tx, NULL, true);
printf("AcceptToMemoryPool : accepted %s (poolsz %"PRIszu")\n",
hash.ToString().substr(0,10).c_str(),
pool.mapTx.size());
SyncWithWallets(tx, NULL, true);
return true;
}

0 comments on commit 739b660

Please sign in to comment.