Skip to content

Commit 98c7c8f

Browse files
committed
Remove dead transaction replacement code
This dead code can be resurrected from git history if transaction replacement is ever implemented. Keeping dead code in the source is a bad idea, because it implies it was tested and worked at some point, which is not true.
1 parent e7e8a75 commit 98c7c8f

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

src/main.cpp

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,6 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
660660
return false;
661661

662662
// Check for conflicts with in-memory transactions
663-
CTransaction* ptxOld = NULL;
664663
{
665664
LOCK(pool.cs); // protect pool.mapNextTx
666665
for (unsigned int i = 0; i < tx.vin.size(); i++)
@@ -670,22 +669,6 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
670669
{
671670
// Disable replacement feature for now
672671
return false;
673-
674-
// Allow replacing with a newer version of the same transaction
675-
if (i != 0)
676-
return false;
677-
ptxOld = pool.mapNextTx[outpoint].ptx;
678-
if (IsFinalTx(*ptxOld))
679-
return false;
680-
if (!tx.IsNewerThan(*ptxOld))
681-
return false;
682-
for (unsigned int i = 0; i < tx.vin.size(); i++)
683-
{
684-
COutPoint outpoint = tx.vin[i].prevout;
685-
if (!pool.mapNextTx.count(outpoint) || pool.mapNextTx[outpoint].ptx != ptxOld)
686-
return false;
687-
}
688-
break;
689672
}
690673
}
691674
}
@@ -782,19 +765,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
782765
}
783766

784767
// Store transaction in memory
785-
{
786-
if (ptxOld)
787-
{
788-
LogPrint("mempool", "AcceptToMemoryPool: : replacing tx %s with new version\n", ptxOld->GetHash().ToString().c_str());
789-
pool.remove(*ptxOld);
790-
}
791-
pool.addUnchecked(hash, tx);
792-
}
768+
pool.addUnchecked(hash, tx);
793769

794-
///// are we sure this is ok when loading transactions or restoring block txes
795-
// If updated, erase old tx from wallet
796-
if (ptxOld)
797-
g_signals.EraseTransaction(ptxOld->GetHash());
798770
g_signals.SyncTransaction(hash, tx, NULL);
799771

800772
return true;

0 commit comments

Comments
 (0)