[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
This commit is contained in:
glozow 2022-12-13 15:51:59 +00:00
parent 6ce265acf4
commit 04528054fc
No known key found for this signature in database
GPG Key ID: BA03F4DBE0C63FB4

View File

@ -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);