6
6
#include < consensus/validation.h>
7
7
#include < crypto/sha256.h>
8
8
#include < test/util/mining.h>
9
+ #include < test/util/script.h>
9
10
#include < test/util/setup_common.h>
10
11
#include < test/util/wallet.h>
11
12
#include < txmempool.h>
@@ -18,23 +19,17 @@ static void AssembleBlock(benchmark::Bench& bench)
18
19
{
19
20
const auto test_setup = MakeNoLogFileContext<const TestingSetup>();
20
21
21
- const std::vector<unsigned char > op_true{OP_TRUE};
22
22
CScriptWitness witness;
23
- witness.stack .push_back (op_true);
24
-
25
- uint256 witness_program;
26
- CSHA256 ().Write (&op_true[0 ], op_true.size ()).Finalize (witness_program.begin ());
27
-
28
- const CScript SCRIPT_PUB{CScript (OP_0) << std::vector<unsigned char >{witness_program.begin (), witness_program.end ()}};
23
+ witness.stack .push_back (WITNESS_STACK_ELEM_OP_TRUE);
29
24
30
25
// Collect some loose transactions that spend the coinbases of our mined blocks
31
26
constexpr size_t NUM_BLOCKS{200 };
32
27
std::array<CTransactionRef, NUM_BLOCKS - COINBASE_MATURITY + 1 > txs;
33
28
for (size_t b{0 }; b < NUM_BLOCKS; ++b) {
34
29
CMutableTransaction tx;
35
- tx.vin .push_back (MineBlock (test_setup->m_node , SCRIPT_PUB ));
30
+ tx.vin .push_back (MineBlock (test_setup->m_node , P2WSH_OP_TRUE ));
36
31
tx.vin .back ().scriptWitness = witness;
37
- tx.vout .emplace_back (1337 , SCRIPT_PUB );
32
+ tx.vout .emplace_back (1337 , P2WSH_OP_TRUE );
38
33
if (NUM_BLOCKS - b >= COINBASE_MATURITY)
39
34
txs.at (b) = MakeTransactionRef (tx);
40
35
}
@@ -48,7 +43,7 @@ static void AssembleBlock(benchmark::Bench& bench)
48
43
}
49
44
50
45
bench.run ([&] {
51
- PrepareBlock (test_setup->m_node , SCRIPT_PUB );
46
+ PrepareBlock (test_setup->m_node , P2WSH_OP_TRUE );
52
47
});
53
48
}
54
49
0 commit comments