From 038784b97959c63751bc75c9d1a9456962120ff0 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 1 Dec 2012 00:26:56 +0100 Subject: [PATCH 1/2] Enable script verification for reorganized mempool tx --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 8279924a3c5..a63aa74a64e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1754,7 +1754,7 @@ bool SetBestChain(CBlockIndex* pindexNew) // Resurrect memory transactions that were in the disconnected branch BOOST_FOREACH(CTransaction& tx, vResurrect) - tx.AcceptToMemoryPool(false); + tx.AcceptToMemoryPool(); // Delete redundant memory transactions that are in the connected branch BOOST_FOREACH(CTransaction& tx, vDelete) From 8259c573212213e3cd8da7146af525e067c4ddaa Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 1 Dec 2012 00:41:27 +0100 Subject: [PATCH 2/2] Only send reorged txn to mempool after checkpoint --- src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a63aa74a64e..320834e9813 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1704,9 +1704,11 @@ bool SetBestChain(CBlockIndex* pindexNew) if (!viewTemp.Flush()) return error("SetBestBlock() : Cache flush failed after disconnect"); - // Queue memory transactions to resurrect + // Queue memory transactions to resurrect. + // We only do this for blocks after the last checkpoint (reorganisation before that + // point should only happen with -reindex/-loadblock, or a misbehaving peer. BOOST_FOREACH(const CTransaction& tx, block.vtx) - if (!tx.IsCoinBase()) + if (!tx.IsCoinBase() && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate()) vResurrect.push_back(tx); }