8
8
9
9
#include < boost/test/unit_test.hpp>
10
10
11
- extern CWallet* pwalletMain;
12
11
extern void SHA256Transform (void * pstate, void * pinput, const void * pinit);
13
12
14
13
BOOST_AUTO_TEST_SUITE (miner_tests)
@@ -51,7 +50,7 @@ struct {
51
50
// NOTE: These tests rely on CreateNewBlock doing its own self-validation!
52
51
BOOST_AUTO_TEST_CASE (CreateNewBlock_validity)
53
52
{
54
- CReserveKey reservekey (pwalletMain) ;
53
+ CScript scriptPubKey = CScript () << ParseHex ( " 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f " ) << OP_CHECKSIG ;
55
54
CBlockTemplate *pblocktemplate;
56
55
CTransaction tx;
57
56
CScript script;
@@ -60,7 +59,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
60
59
LOCK (cs_main);
61
60
62
61
// Simple block creation, nothing special yet:
63
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
62
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
64
63
65
64
// We can't make transactions until we have inputs
66
65
// Therefore, load 100 blocks :)
@@ -86,7 +85,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
86
85
delete pblocktemplate;
87
86
88
87
// Just to make sure we can still make simple blocks
89
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
88
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
90
89
delete pblocktemplate;
91
90
92
91
// block sigops > limit: 1000 CHECKMULTISIG + 1
@@ -104,7 +103,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
104
103
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
105
104
tx.vin [0 ].prevout .hash = hash;
106
105
}
107
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
106
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
108
107
delete pblocktemplate;
109
108
mempool.clear ();
110
109
@@ -124,14 +123,14 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
124
123
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
125
124
tx.vin [0 ].prevout .hash = hash;
126
125
}
127
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
126
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
128
127
delete pblocktemplate;
129
128
mempool.clear ();
130
129
131
130
// orphan in mempool
132
131
hash = tx.GetHash ();
133
132
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
134
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
133
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
135
134
delete pblocktemplate;
136
135
mempool.clear ();
137
136
@@ -149,7 +148,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
149
148
tx.vout [0 ].nValue = 5900000000LL ;
150
149
hash = tx.GetHash ();
151
150
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
152
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
151
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
153
152
delete pblocktemplate;
154
153
mempool.clear ();
155
154
@@ -160,7 +159,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
160
159
tx.vout [0 ].nValue = 0 ;
161
160
hash = tx.GetHash ();
162
161
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
163
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
162
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
164
163
delete pblocktemplate;
165
164
mempool.clear ();
166
165
@@ -178,7 +177,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
178
177
tx.vout [0 ].nValue -= 1000000 ;
179
178
hash = tx.GetHash ();
180
179
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
181
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
180
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
182
181
delete pblocktemplate;
183
182
mempool.clear ();
184
183
@@ -192,17 +191,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
192
191
tx.vout [0 ].scriptPubKey = CScript () << OP_2;
193
192
hash = tx.GetHash ();
194
193
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
195
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
194
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
196
195
delete pblocktemplate;
197
196
mempool.clear ();
198
197
199
198
// subsidy changing
200
199
int nHeight = chainActive.Height ();
201
200
chainActive.Tip ()->nHeight = 209999 ;
202
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
201
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
203
202
delete pblocktemplate;
204
203
chainActive.Tip ()->nHeight = 210000 ;
205
- BOOST_CHECK (pblocktemplate = CreateNewBlockWithKey (reservekey ));
204
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey ));
206
205
delete pblocktemplate;
207
206
chainActive.Tip ()->nHeight = nHeight;
208
207
0 commit comments