aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2022-12-13 15:51:59 +0000
committerglozow <gloriajzhao@gmail.com>2022-12-22 11:33:46 +0000
commit04528054fcde61aa00e009dbbe1ac350ca1cf748 (patch)
treefc7c02976dc36d6600294ae611e9f2212d0d7dcd /src/bench
parent6ce265acf4ff6ee5057b46bcb8b55abc4422e6f8 (diff)
[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
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/block_assemble.cpp14
1 files changed, 14 insertions, 0 deletions
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 <bench/bench.h>
#include <consensus/validation.h>
#include <crypto/sha256.h>
+#include <node/miner.h>
#include <test/util/mining.h>
#include <test/util/script.h>
#include <test/util/setup_common.h>
@@ -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<TestChain100Setup>()};
+ 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);