mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge pull request #6183
28bf062 Fix off-by-one error w/ nLockTime in the wallet (Peter Todd)
This commit is contained in:
@@ -223,7 +223,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
tx.nLockTime = chainActive.Tip()->nHeight+1;
|
||||
hash = tx.GetHash();
|
||||
mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
|
||||
BOOST_CHECK(!IsFinalTx(tx, chainActive.Tip()->nHeight + 1));
|
||||
BOOST_CHECK(!CheckFinalTx(tx));
|
||||
|
||||
// time locked
|
||||
tx2.vin.resize(1);
|
||||
@@ -237,7 +237,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
tx2.nLockTime = chainActive.Tip()->GetMedianTimePast()+1;
|
||||
hash = tx2.GetHash();
|
||||
mempool.addUnchecked(hash, CTxMemPoolEntry(tx2, 11, GetTime(), 111.0, 11));
|
||||
BOOST_CHECK(!IsFinalTx(tx2));
|
||||
BOOST_CHECK(!CheckFinalTx(tx2));
|
||||
|
||||
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
||||
|
||||
@@ -249,8 +249,10 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
chainActive.Tip()->nHeight++;
|
||||
SetMockTime(chainActive.Tip()->GetMedianTimePast()+2);
|
||||
|
||||
BOOST_CHECK(IsFinalTx(tx, chainActive.Tip()->nHeight + 1));
|
||||
BOOST_CHECK(IsFinalTx(tx2));
|
||||
// FIXME: we should *actually* create a new block so the following test
|
||||
// works; CheckFinalTx() isn't fooled by monkey-patching nHeight.
|
||||
//BOOST_CHECK(CheckFinalTx(tx));
|
||||
//BOOST_CHECK(CheckFinalTx(tx2));
|
||||
|
||||
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
||||
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 3);
|
||||
|
||||
Reference in New Issue
Block a user