Skip to content

Commit 0452805

Browse files
committed
[bench] BlockAssembler with mempool packages
The current BlockAssembler bench only tests on a mempool where all transactions have 0 ancestors or descendants, which does not exercise any of the package-handling logic in BlockAssembler
1 parent 6ce265a commit 0452805

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/bench/block_assemble.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <bench/bench.h>
66
#include <consensus/validation.h>
77
#include <crypto/sha256.h>
8+
#include <node/miner.h>
89
#include <test/util/mining.h>
910
#include <test/util/script.h>
1011
#include <test/util/setup_common.h>
@@ -45,5 +46,18 @@ static void AssembleBlock(benchmark::Bench& bench)
4546
PrepareBlock(test_setup->m_node, P2WSH_OP_TRUE);
4647
});
4748
}
49+
static void BlockAssemblerAddPackageTxns(benchmark::Bench& bench)
50+
{
51+
FastRandomContext det_rand{true};
52+
auto testing_setup{MakeNoLogFileContext<TestChain100Setup>()};
53+
testing_setup->PopulateMempool(det_rand, /*num_transactions=*/1000, /*submit=*/true);
54+
node::BlockAssembler::Options assembler_options;
55+
assembler_options.test_block_validity = false;
56+
57+
bench.run([&] {
58+
PrepareBlock(testing_setup->m_node, P2WSH_OP_TRUE, assembler_options);
59+
});
60+
}
4861

4962
BENCHMARK(AssembleBlock, benchmark::PriorityLevel::HIGH);
63+
BENCHMARK(BlockAssemblerAddPackageTxns, benchmark::PriorityLevel::LOW);

0 commit comments

Comments
 (0)