aboutsummaryrefslogtreecommitdiff
path: root/src/test/miner_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/miner_tests.cpp')
-rw-r--r--src/test/miner_tests.cpp40
1 files changed, 7 insertions, 33 deletions
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
index b72ba0293f..47977cf295 100644
--- a/src/test/miner_tests.cpp
+++ b/src/test/miner_tests.cpp
@@ -9,8 +9,6 @@
#include <boost/test/unit_test.hpp>
-extern void SHA256Transform(void* pstate, void* pinput, const void* pinit);
-
BOOST_AUTO_TEST_SUITE(miner_tests)
static
@@ -53,7 +51,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
{
CScript scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
CBlockTemplate *pblocktemplate;
- CTransaction tx,tx2;
+ CMutableTransaction tx,tx2;
CScript script;
uint256 hash;
@@ -70,10 +68,12 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
pblock->nVersion = 1;
pblock->nTime = chainActive.Tip()->GetMedianTimePast()+1;
- pblock->vtx[0].vin[0].scriptSig = CScript();
- pblock->vtx[0].vin[0].scriptSig.push_back(blockinfo[i].extranonce);
- pblock->vtx[0].vin[0].scriptSig.push_back(chainActive.Height());
- pblock->vtx[0].vout[0].scriptPubKey = CScript();
+ CMutableTransaction txCoinbase(pblock->vtx[0]);
+ txCoinbase.vin[0].scriptSig = CScript();
+ txCoinbase.vin[0].scriptSig.push_back(blockinfo[i].extranonce);
+ txCoinbase.vin[0].scriptSig.push_back(chainActive.Height());
+ txCoinbase.vout[0].scriptPubKey = CScript();
+ pblock->vtx[0] = CTransaction(txCoinbase);
if (txFirst.size() < 2)
txFirst.push_back(new CTransaction(pblock->vtx[0]));
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
@@ -259,30 +259,4 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
}
-BOOST_AUTO_TEST_CASE(sha256transform_equality)
-{
- unsigned int pSHA256InitState[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
-
-
- // unsigned char pstate[32];
- unsigned char pinput[64];
-
- int i;
-
- for (i = 0; i < 32; i++) {
- pinput[i] = i;
- pinput[i+32] = 0;
- }
-
- uint256 hash;
-
- SHA256Transform(&hash, pinput, pSHA256InitState);
-
- BOOST_TEST_MESSAGE(hash.GetHex());
-
- uint256 hash_reference("0x2df5e1c65ef9f8cde240d23cae2ec036d31a15ec64bc68f64be242b1da6631f3");
-
- BOOST_CHECK(hash == hash_reference);
-}
-
BOOST_AUTO_TEST_SUITE_END()