Skip to content

Commit fa899fb

Browse files
author
MarcoFalke
committed
fuzz: Speed up utxo_snapshot fuzz target
This speeds up the fuzz target, which allows "valid" inputs. It does not affect the "INVALID" fuzz target.
1 parent fa38664 commit fa899fb

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/test/fuzz/utxo_snapshot.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void initialize_chain()
5151
TestOpts{
5252
.setup_net = false,
5353
.setup_validation_interface = false,
54+
.min_validation_cache = true,
5455
}),
5556
};
5657
if constexpr (INVALID) {

src/test/util/setup_common.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,20 @@ ChainTestingSetup::ChainTestingSetup(const ChainType chainType, TestOpts opts)
244244

245245
m_node.notifications = std::make_unique<KernelNotifications>(*Assert(m_node.shutdown), m_node.exit_status, *Assert(m_node.warnings));
246246

247-
m_make_chainman = [this, &chainparams] {
247+
m_make_chainman = [this, &chainparams, opts] {
248248
Assert(!m_node.chainman);
249-
const ChainstateManager::Options chainman_opts{
249+
ChainstateManager::Options chainman_opts{
250250
.chainparams = chainparams,
251251
.datadir = m_args.GetDataDirNet(),
252252
.check_block_index = 1,
253253
.notifications = *m_node.notifications,
254254
.signals = m_node.validation_signals.get(),
255255
.worker_threads_num = 2,
256256
};
257+
if (opts.min_validation_cache) {
258+
chainman_opts.script_execution_cache_bytes = 0;
259+
chainman_opts.signature_cache_bytes = 0;
260+
}
257261
const BlockManager::Options blockman_opts{
258262
.chainparams = chainman_opts.chainparams,
259263
.blocks_dir = m_args.GetBlocksDirPath(),

src/test/util/setup_common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2015-2022 The Bitcoin Core developers
1+
// Copyright (c) 2015-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -55,6 +55,7 @@ struct TestOpts {
5555
bool block_tree_db_in_memory{true};
5656
bool setup_net{true};
5757
bool setup_validation_interface{true};
58+
bool min_validation_cache{false}; // Equivalent of -maxsigcachebytes=0
5859
};
5960

6061
/** Basic testing setup.

0 commit comments

Comments
 (0)