|
|
@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
for (unsigned int i = 0; i < sizeof(blockinfo)/sizeof(*blockinfo); ++i) |
|
|
|
{ |
|
|
|
// Simple block creation, nothing special yet:
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
|
|
|
|
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
|
|
|
|
pblock->nVersion = 4; |
|
|
@ -273,7 +273,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
} |
|
|
|
|
|
|
|
// Just to make sure we can still make simple blocks
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
|
|
|
|
// block sigops > limit: 1000 CHECKMULTISIG + 1
|
|
|
@ -292,7 +292,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
mempool.addUnchecked(hash, entry.Time(GetTime()).SpendsCoinbase(spendsCoinbase).FromTx(tx)); |
|
|
|
tx.vin[0].prevout.hash = hash; |
|
|
|
} |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
mempool.clear(); |
|
|
|
|
|
|
@ -313,14 +313,14 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
mempool.addUnchecked(hash, entry.Time(GetTime()).SpendsCoinbase(spendsCoinbase).FromTx(tx)); |
|
|
|
tx.vin[0].prevout.hash = hash; |
|
|
|
} |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
mempool.clear(); |
|
|
|
|
|
|
|
// orphan in mempool
|
|
|
|
hash = tx.GetHash(); |
|
|
|
mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
mempool.clear(); |
|
|
|
|
|
|
@ -338,7 +338,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
tx.vout[0].nValue = 49000LL; |
|
|
|
hash = tx.GetHash(); |
|
|
|
mempool.addUnchecked(hash, entry.Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
mempool.clear(); |
|
|
|
|
|
|
@ -349,7 +349,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
tx.vout[0].nValue = 0; |
|
|
|
hash = tx.GetHash(); |
|
|
|
mempool.addUnchecked(hash, entry.Time(GetTime()).SpendsCoinbase(false).FromTx(tx)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
mempool.clear(); |
|
|
|
|
|
|
@ -367,7 +367,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
tx.vout[0].nValue -= 10000; |
|
|
|
hash = tx.GetHash(); |
|
|
|
mempool.addUnchecked(hash, entry.Time(GetTime()).SpendsCoinbase(false).FromTx(tx)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
mempool.clear(); |
|
|
|
|
|
|
@ -381,17 +381,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
tx.vout[0].scriptPubKey = CScript() << OP_2; |
|
|
|
hash = tx.GetHash(); |
|
|
|
mempool.addUnchecked(hash, entry.Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
mempool.clear(); |
|
|
|
|
|
|
|
// subsidy changing
|
|
|
|
int nHeight = chainActive.Height(); |
|
|
|
chainActive.Tip()->SetHeight(209999); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
chainActive.Tip()->SetHeight(210000); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
delete pblocktemplate; |
|
|
|
chainActive.Tip()->SetHeight(nHeight); |
|
|
|
|
|
|
@ -423,7 +423,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
mempool.addUnchecked(hash, entry.Time(GetTime()).SpendsCoinbase(true).FromTx(tx2)); |
|
|
|
BOOST_CHECK(!CheckFinalTx(tx2, LOCKTIME_MEDIAN_TIME_PAST)); |
|
|
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
|
|
|
|
// Neither tx should have made it into the template.
|
|
|
|
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 1); |
|
|
@ -438,7 +438,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) |
|
|
|
//BOOST_CHECK(CheckFinalTx(tx));
|
|
|
|
//BOOST_CHECK(CheckFinalTx(tx2));
|
|
|
|
|
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey,-1)); |
|
|
|
BOOST_CHECK(pblocktemplate = CreateNewBlock(CPubKey(),scriptPubKey,-1)); |
|
|
|
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 2); |
|
|
|
delete pblocktemplate; |
|
|
|
|
|
|
|