mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
[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:
parent
6ce265acf4
commit
04528054fc
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user