mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 13:49:35 +02:00
fuzz: Add SetMockTime() to necessary targets
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <test/util/mining.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/chaintype.h>
|
||||
#include <util/time.h>
|
||||
#include <validation.h>
|
||||
|
||||
using node::BlockAssembler;
|
||||
@@ -22,18 +23,22 @@ using node::BlockAssembler;
|
||||
FUZZ_TARGET(utxo_total_supply)
|
||||
{
|
||||
SeedRandomStateForTest(SeedRand::ZEROS);
|
||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||
const auto mock_time{ConsumeTime(fuzzed_data_provider, /*min=*/1296688602)}; // regtest genesis block timestamp
|
||||
/** The testing setup that creates a chainman only (no chainstate) */
|
||||
ChainTestingSetup test_setup{
|
||||
ChainType::REGTEST,
|
||||
{
|
||||
.extra_args = {"-testactivationheight=bip34@2"},
|
||||
.extra_args = {
|
||||
"-testactivationheight=bip34@2",
|
||||
strprintf("-mocktime=%d", mock_time).c_str()
|
||||
},
|
||||
},
|
||||
};
|
||||
// Create chainstate
|
||||
test_setup.LoadVerifyActivateChainstate();
|
||||
auto& node{test_setup.m_node};
|
||||
auto& chainman{*Assert(test_setup.m_node.chainman)};
|
||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||
|
||||
const auto ActiveHeight = [&]() {
|
||||
LOCK(chainman.GetMutex());
|
||||
|
||||
Reference in New Issue
Block a user