From 665bdd3bc9ba4ac566edf5ba3fa8bbd93eb4780f Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Sun, 26 Jan 2014 21:50:15 -0500 Subject: Fix off-by-one errors in use of IsFinalTx() Previously CreateNewBlock() didn't take into account the fact that IsFinalTx() without any arguments tests if the transaction is considered final in the *current* block, when both those functions really needed to know if the transaction would be final in the *next* block. Additionally the UI had a similar misunderstanding. Also adds some basic tests to check that CreateNewBlock() is in fact mining nLockTime-using transactions correctly. Thanks to Wladimir J. van der Laan for rebase. --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/miner.cpp') diff --git a/src/miner.cpp b/src/miner.cpp index ca3b65a11..f9dab4bd6 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -158,7 +158,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) mi != mempool.mapTx.end(); ++mi) { const CTransaction& tx = mi->second.GetTx(); - if (tx.IsCoinBase() || !IsFinalTx(tx)) + if (tx.IsCoinBase() || !IsFinalTx(tx, pindexPrev->nHeight + 1)) continue; COrphan* porphan = NULL; -- cgit v1.2.3