|
|
|
@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
fCheckpointsEnabled = false;
|
|
|
|
|
|
|
|
|
|
// Simple block creation, nothing special yet:
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
|
|
|
|
|
// We can't make transactions until we have inputs
|
|
|
|
|
// Therefore, load 100 blocks :)
|
|
|
|
@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
|
|
|
|
|
// Just to make sure we can still make simple blocks
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
|
|
|
|
|
// block sigops > limit: 1000 CHECKMULTISIG + 1
|
|
|
|
@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
|
|
|
|
|
tx.vin[0].prevout.hash = hash;
|
|
|
|
|
}
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
mempool.clear();
|
|
|
|
|
|
|
|
|
@ -137,14 +137,14 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
|
|
|
|
|
tx.vin[0].prevout.hash = hash;
|
|
|
|
|
}
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
mempool.clear();
|
|
|
|
|
|
|
|
|
|
// orphan in mempool
|
|
|
|
|
hash = tx.GetHash();
|
|
|
|
|
mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
mempool.clear();
|
|
|
|
|
|
|
|
|
@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
tx.vout[0].nValue = 5900000000LL;
|
|
|
|
|
hash = tx.GetHash();
|
|
|
|
|
mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
mempool.clear();
|
|
|
|
|
|
|
|
|
@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
tx.vout[0].nValue = 0;
|
|
|
|
|
hash = tx.GetHash();
|
|
|
|
|
mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
mempool.clear();
|
|
|
|
|
|
|
|
|
@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
tx.vout[0].nValue -= 1000000;
|
|
|
|
|
hash = tx.GetHash();
|
|
|
|
|
mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
mempool.clear();
|
|
|
|
|
|
|
|
|
@ -205,17 +205,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
tx.vout[0].scriptPubKey = CScript() << OP_2;
|
|
|
|
|
hash = tx.GetHash();
|
|
|
|
|
mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
mempool.clear();
|
|
|
|
|
|
|
|
|
|
// subsidy changing
|
|
|
|
|
int nHeight = chainActive.Height();
|
|
|
|
|
chainActive.Tip()->nHeight = 209999;
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
chainActive.Tip()->nHeight = 210000;
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
chainActive.Tip()->nHeight = nHeight;
|
|
|
|
|
|
|
|
|
@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
mempool.addUnchecked(hash, CTxMemPoolEntry(tx2, 11, GetTime(), 111.0, 11));
|
|
|
|
|
BOOST_CHECK(!CheckFinalTx(tx2, LOCKTIME_MEDIAN_TIME_PAST));
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
|
|
|
|
|
// Neither tx should have make it into the template.
|
|
|
|
|
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 1);
|
|
|
|
@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
|
|
|
|
//BOOST_CHECK(CheckFinalTx(tx));
|
|
|
|
|
//BOOST_CHECK(CheckFinalTx(tx2));
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
|
|
|
|
|
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 2);
|
|
|
|
|
delete pblocktemplate;
|
|
|
|
|
|
|
|
|
|