2020#include < memory>
2121#include < vector>
2222
23+ using node::BlockAssembler;
24+
2325static void AssembleBlock (benchmark::Bench& bench)
2426{
2527 const auto test_setup = MakeNoLogFileContext<const TestingSetup>();
2628
2729 CScriptWitness witness;
2830 witness.stack .push_back (WITNESS_STACK_ELEM_OP_TRUE);
31+ BlockAssembler::Options options;
32+ options.coinbase_output_script = P2WSH_OP_TRUE;
2933
3034 // Collect some loose transactions that spend the coinbases of our mined blocks
3135 constexpr size_t NUM_BLOCKS{200 };
3236 std::array<CTransactionRef, NUM_BLOCKS - COINBASE_MATURITY + 1 > txs;
3337 for (size_t b{0 }; b < NUM_BLOCKS; ++b) {
3438 CMutableTransaction tx;
35- tx.vin .emplace_back (MineBlock (test_setup->m_node , P2WSH_OP_TRUE ));
39+ tx.vin .emplace_back (MineBlock (test_setup->m_node , options ));
3640 tx.vin .back ().scriptWitness = witness;
3741 tx.vout .emplace_back (1337 , P2WSH_OP_TRUE);
3842 if (NUM_BLOCKS - b >= COINBASE_MATURITY)
@@ -48,19 +52,20 @@ static void AssembleBlock(benchmark::Bench& bench)
4852 }
4953
5054 bench.run ([&] {
51- PrepareBlock (test_setup->m_node , P2WSH_OP_TRUE );
55+ PrepareBlock (test_setup->m_node , options );
5256 });
5357}
5458static void BlockAssemblerAddPackageTxns (benchmark::Bench& bench)
5559{
5660 FastRandomContext det_rand{true };
5761 auto testing_setup{MakeNoLogFileContext<TestChain100Setup>()};
5862 testing_setup->PopulateMempool (det_rand, /* num_transactions=*/ 1000 , /* submit=*/ true );
59- node:: BlockAssembler::Options assembler_options;
63+ BlockAssembler::Options assembler_options;
6064 assembler_options.test_block_validity = false ;
65+ assembler_options.coinbase_output_script = P2WSH_OP_TRUE;
6166
6267 bench.run ([&] {
63- PrepareBlock (testing_setup->m_node , P2WSH_OP_TRUE, assembler_options);
68+ PrepareBlock (testing_setup->m_node , assembler_options);
6469 });
6570}
6671
0 commit comments