From 04528054fcde61aa00e009dbbe1ac350ca1cf748 Mon Sep 17 00:00:00 2001 From: glozow Date: Tue, 13 Dec 2022 15:51:59 +0000 Subject: [PATCH] [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 --- src/bench/block_assemble.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bench/block_assemble.cpp b/src/bench/block_assemble.cpp index 69258377d5..5ba3bbf11b 100644 --- a/src/bench/block_assemble.cpp +++ b/src/bench/block_assemble.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -45,5 +46,18 @@ static void AssembleBlock(benchmark::Bench& bench) PrepareBlock(test_setup->m_node, P2WSH_OP_TRUE); }); } +static void BlockAssemblerAddPackageTxns(benchmark::Bench& bench) +{ + FastRandomContext det_rand{true}; + auto testing_setup{MakeNoLogFileContext()}; + testing_setup->PopulateMempool(det_rand, /*num_transactions=*/1000, /*submit=*/true); + node::BlockAssembler::Options assembler_options; + assembler_options.test_block_validity = false; + + bench.run([&] { + PrepareBlock(testing_setup->m_node, P2WSH_OP_TRUE, assembler_options); + }); +} BENCHMARK(AssembleBlock, benchmark::PriorityLevel::HIGH); +BENCHMARK(BlockAssemblerAddPackageTxns, benchmark::PriorityLevel::LOW);