@@ -122,7 +122,7 @@ void MinerTestingSetup::TestPackageSelection(const CChainParams& chainparams, co
122122 uint256 hashHighFeeTx = tx.GetHash ();
123123 m_node.mempool ->addUnchecked (entry.Fee (50000 ).Time (GetTime ()).SpendsCoinbase (false ).FromTx (tx));
124124
125- std::unique_ptr<CBlockTemplate> pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey);
125+ std::unique_ptr<CBlockTemplate> pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey);
126126 BOOST_REQUIRE_EQUAL (pblocktemplate->block .vtx .size (), 4U );
127127 BOOST_CHECK (pblocktemplate->block .vtx [1 ]->GetHash () == hashParentTx);
128128 BOOST_CHECK (pblocktemplate->block .vtx [2 ]->GetHash () == hashHighFeeTx);
@@ -143,7 +143,7 @@ void MinerTestingSetup::TestPackageSelection(const CChainParams& chainparams, co
143143 tx.vout [0 ].nValue = 5000000000LL - 1000 - 50000 - feeToUse;
144144 uint256 hashLowFeeTx = tx.GetHash ();
145145 m_node.mempool ->addUnchecked (entry.Fee (feeToUse).FromTx (tx));
146- pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey);
146+ pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey);
147147 // Verify that the free tx and the low fee tx didn't get selected
148148 for (size_t i=0 ; i<pblocktemplate->block .vtx .size (); ++i) {
149149 BOOST_CHECK (pblocktemplate->block .vtx [i]->GetHash () != hashFreeTx);
@@ -157,7 +157,7 @@ void MinerTestingSetup::TestPackageSelection(const CChainParams& chainparams, co
157157 tx.vout [0 ].nValue -= 2 ; // Now we should be just over the min relay fee
158158 hashLowFeeTx = tx.GetHash ();
159159 m_node.mempool ->addUnchecked (entry.Fee (feeToUse+2 ).FromTx (tx));
160- pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey);
160+ pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey);
161161 BOOST_REQUIRE_EQUAL (pblocktemplate->block .vtx .size (), 6U );
162162 BOOST_CHECK (pblocktemplate->block .vtx [4 ]->GetHash () == hashFreeTx);
163163 BOOST_CHECK (pblocktemplate->block .vtx [5 ]->GetHash () == hashLowFeeTx);
@@ -179,7 +179,7 @@ void MinerTestingSetup::TestPackageSelection(const CChainParams& chainparams, co
179179 tx.vout [0 ].nValue = 5000000000LL - 100000000 - feeToUse;
180180 uint256 hashLowFeeTx2 = tx.GetHash ();
181181 m_node.mempool ->addUnchecked (entry.Fee (feeToUse).SpendsCoinbase (false ).FromTx (tx));
182- pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey);
182+ pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey);
183183
184184 // Verify that this tx isn't selected.
185185 for (size_t i=0 ; i<pblocktemplate->block .vtx .size (); ++i) {
@@ -192,7 +192,7 @@ void MinerTestingSetup::TestPackageSelection(const CChainParams& chainparams, co
192192 tx.vin [0 ].prevout .n = 1 ;
193193 tx.vout [0 ].nValue = 100000000 - 10000 ; // 10k satoshi fee
194194 m_node.mempool ->addUnchecked (entry.Fee (10000 ).FromTx (tx));
195- pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey);
195+ pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey);
196196 BOOST_REQUIRE_EQUAL (pblocktemplate->block .vtx .size (), 9U );
197197 BOOST_CHECK (pblocktemplate->block .vtx [8 ]->GetHash () == hashLowFeeTx2);
198198}
@@ -215,7 +215,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
215215 fCheckpointsEnabled = false ;
216216
217217 // Simple block creation, nothing special yet:
218- BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey));
218+ BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey));
219219
220220 // We can't make transactions until we have inputs
221221 // Therefore, load 110 blocks :)
@@ -252,7 +252,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
252252 LOCK (m_node.mempool ->cs );
253253
254254 // Just to make sure we can still make simple blocks
255- BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey));
255+ BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey));
256256
257257 const CAmount BLOCKSUBSIDY = 50 *COIN;
258258 const CAmount LOWFEE = CENT;
@@ -277,7 +277,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
277277 tx.vin [0 ].prevout .hash = hash;
278278 }
279279
280- BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" bad-blk-sigops" ));
280+ BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey), std::runtime_error, HasReason (" bad-blk-sigops" ));
281281 m_node.mempool ->clear ();
282282
283283 tx.vin [0 ].prevout .hash = txFirst[0 ]->GetHash ();
@@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
291291 m_node.mempool ->addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (spendsCoinbase).SigOpsCost (80 ).FromTx (tx));
292292 tx.vin [0 ].prevout .hash = hash;
293293 }
294- BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey));
294+ BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey));
295295 m_node.mempool ->clear ();
296296
297297 // block size > limit
@@ -311,13 +311,13 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
311311 m_node.mempool ->addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (spendsCoinbase).FromTx (tx));
312312 tx.vin [0 ].prevout .hash = hash;
313313 }
314- BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey));
314+ BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey));
315315 m_node.mempool ->clear ();
316316
317317 // orphan in *m_node.mempool, template creation fails
318318 hash = tx.GetHash ();
319319 m_node.mempool ->addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).FromTx (tx));
320- BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" bad-txns-inputs-missingorspent" ));
320+ BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey), std::runtime_error, HasReason (" bad-txns-inputs-missingorspent" ));
321321 m_node.mempool ->clear ();
322322
323323 // child with higher feerate than parent
@@ -334,7 +334,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
334334 tx.vout [0 ].nValue = tx.vout [0 ].nValue +BLOCKSUBSIDY-HIGHERFEE; // First txn output + fresh coinbase - new txn fee
335335 hash = tx.GetHash ();
336336 m_node.mempool ->addUnchecked (entry.Fee (HIGHERFEE).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
337- BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey));
337+ BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey));
338338 m_node.mempool ->clear ();
339339
340340 // coinbase in *m_node.mempool, template creation fails
@@ -346,7 +346,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
346346 // give it a fee so it'll get mined
347347 m_node.mempool ->addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (false ).FromTx (tx));
348348 // Should throw bad-cb-multiple
349- BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" bad-cb-multiple" ));
349+ BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey), std::runtime_error, HasReason (" bad-cb-multiple" ));
350350 m_node.mempool ->clear ();
351351
352352 // double spend txn pair in *m_node.mempool, template creation fails
@@ -359,7 +359,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
359359 tx.vout [0 ].scriptPubKey = CScript () << OP_2;
360360 hash = tx.GetHash ();
361361 m_node.mempool ->addUnchecked (entry.Fee (HIGHFEE).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
362- BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" bad-txns-inputs-missingorspent" ));
362+ BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey), std::runtime_error, HasReason (" bad-txns-inputs-missingorspent" ));
363363 m_node.mempool ->clear ();
364364
365365 // subsidy changing
@@ -375,7 +375,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
375375 next->BuildSkip ();
376376 ::ChainActive ().SetTip(next);
377377 }
378- BOOST_CHECK (pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey));
378+ BOOST_CHECK (pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(::ChainstateActive(), scriptPubKey));
379379 // Extend to a 210000-long block chain.
380380 while (::ChainActive().Tip()->nHeight < 210000) {
381381 CBlockIndex* prev = ::ChainActive ().Tip ();
@@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
387387 next->BuildSkip ();
388388 ::ChainActive ().SetTip(next);
389389 }
390- BOOST_CHECK (pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey));
390+ BOOST_CHECK (pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(::ChainstateActive(), scriptPubKey));
391391
392392 // invalid p2sh txn in *m_node.mempool, template creation fails
393393 tx.vin[0 ].prevout.hash = txFirst[0 ]->GetHash ();
@@ -404,7 +404,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
404404 hash = tx.GetHash ();
405405 m_node.mempool ->addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (false ).FromTx (tx));
406406 // Should throw block-validation-failed
407- BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" block-validation-failed" ));
407+ BOOST_CHECK_EXCEPTION (AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey), std::runtime_error, HasReason (" block-validation-failed" ));
408408 m_node.mempool ->clear ();
409409
410410 // Delete the dummy blocks again.
@@ -492,7 +492,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
492492 tx.vin [0 ].nSequence = CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG | 1 ;
493493 BOOST_CHECK (!TestSequenceLocks (CTransaction (tx), flags)); // Sequence locks fail
494494
495- BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey));
495+ BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey));
496496
497497 // None of the of the absolute height/time locked tx should have made
498498 // it into the template because we still check IsFinalTx in CreateNewBlock,
@@ -505,7 +505,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
505505 ::ChainActive ().Tip()->nHeight++;
506506 SetMockTime (::ChainActive ().Tip ()->GetMedianTimePast () + 1 );
507507
508- BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (scriptPubKey));
508+ BOOST_CHECK (pblocktemplate = AssemblerForTest (chainparams).CreateNewBlock (:: ChainstateActive (), scriptPubKey));
509509 BOOST_CHECK_EQUAL (pblocktemplate->block .vtx .size (), 5U );
510510
511511 ::ChainActive ().Tip()->nHeight--;
0 commit comments