@@ -62,7 +62,8 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
62
62
Checkpoints::fEnabled = false ;
63
63
64
64
// Simple block creation, nothing special yet:
65
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
65
+ CBlockIndex* pindexPrev;
66
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev));
66
67
67
68
// We can't make transactions until we have inputs
68
69
// Therefore, load 100 blocks :)
@@ -90,7 +91,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
90
91
delete pblocktemplate;
91
92
92
93
// Just to make sure we can still make simple blocks
93
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
94
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
94
95
delete pblocktemplate;
95
96
96
97
// block sigops > limit: 1000 CHECKMULTISIG + 1
@@ -108,7 +109,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
108
109
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
109
110
tx.vin [0 ].prevout .hash = hash;
110
111
}
111
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
112
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
112
113
delete pblocktemplate;
113
114
mempool.clear ();
114
115
@@ -128,14 +129,14 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
128
129
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
129
130
tx.vin [0 ].prevout .hash = hash;
130
131
}
131
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
132
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
132
133
delete pblocktemplate;
133
134
mempool.clear ();
134
135
135
136
// orphan in mempool
136
137
hash = tx.GetHash ();
137
138
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
138
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
139
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
139
140
delete pblocktemplate;
140
141
mempool.clear ();
141
142
@@ -153,7 +154,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
153
154
tx.vout [0 ].nValue = 5900000000LL ;
154
155
hash = tx.GetHash ();
155
156
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
156
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
157
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
157
158
delete pblocktemplate;
158
159
mempool.clear ();
159
160
@@ -164,7 +165,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
164
165
tx.vout [0 ].nValue = 0 ;
165
166
hash = tx.GetHash ();
166
167
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
167
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
168
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
168
169
delete pblocktemplate;
169
170
mempool.clear ();
170
171
@@ -182,7 +183,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
182
183
tx.vout [0 ].nValue -= 1000000 ;
183
184
hash = tx.GetHash ();
184
185
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
185
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
186
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
186
187
delete pblocktemplate;
187
188
mempool.clear ();
188
189
@@ -196,17 +197,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
196
197
tx.vout [0 ].scriptPubKey = CScript () << OP_2;
197
198
hash = tx.GetHash ();
198
199
mempool.addUnchecked (hash, CTxMemPoolEntry (tx, 11 , GetTime (), 111.0 , 11 ));
199
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
200
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
200
201
delete pblocktemplate;
201
202
mempool.clear ();
202
203
203
204
// subsidy changing
204
205
int nHeight = chainActive.Height ();
205
206
chainActive.Tip ()->nHeight = 209999 ;
206
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
207
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
207
208
delete pblocktemplate;
208
209
chainActive.Tip ()->nHeight = 210000 ;
209
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
210
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
210
211
delete pblocktemplate;
211
212
chainActive.Tip ()->nHeight = nHeight;
212
213
@@ -238,7 +239,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
238
239
mempool.addUnchecked (hash, CTxMemPoolEntry (tx2, 11 , GetTime (), 111.0 , 11 ));
239
240
BOOST_CHECK (!IsFinalTx (tx2));
240
241
241
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
242
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
242
243
243
244
// Neither tx should have make it into the template.
244
245
BOOST_CHECK_EQUAL (pblocktemplate->block .vtx .size (), 1 );
@@ -251,7 +252,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
251
252
BOOST_CHECK (IsFinalTx (tx, chainActive.Tip ()->nHeight + 1 ));
252
253
BOOST_CHECK (IsFinalTx (tx2));
253
254
254
- BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey));
255
+ BOOST_CHECK (pblocktemplate = CreateNewBlock (scriptPubKey, pindexPrev ));
255
256
BOOST_CHECK_EQUAL (pblocktemplate->block .vtx .size (), 3 );
256
257
delete pblocktemplate;
257
258
0 commit comments