Bitcoin Core 32.99.0
P2P Digital Currency
Loading...
Searching...
No Matches
load_external_block_file.cpp
Go to the documentation of this file.
1// Copyright (c) 2020-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <chainparams.h>
6#include <clientversion.h>
7#include <flatfile.h>
9#include <test/fuzz/fuzz.h>
10#include <test/fuzz/util.h>
12#include <test/util/time.h>
13#include <util/time.h>
14#include <validation.h>
15
16#include <cstdint>
17#include <vector>
18
19namespace {
21} // namespace
22
24{
25 static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
26 g_setup = testing_setup.get();
27}
28
30{
31 FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
35 if (fuzzed_block_file.IsNull()) {
36 return;
37 }
39 // Corresponds to the -reindex case (track orphan blocks across files).
41 std::multimap<uint256, FlatFilePos> blocks_with_unknown_parent;
43 } else {
44 // Corresponds to the -loadblock= case (orphan blocks aren't tracked across files).
45 g_setup->m_node.chainman->LoadExternalBlockFile(fuzzed_block_file);
46 }
47}
const TestingSetup * g_setup
Non-refcounted RAII wrapper for FILE*.
Definition streams.h:395
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
Definition time.h:54
#define FUZZ_TARGET(...)
Definition fuzz.h:35
void initialize_load_external_block_file()
Definition basic.cpp:11
node::NodeContext m_node
Testing setup that configures a complete environment.
std::unique_ptr< ChainstateManager > chainman
Definition context.h:74
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
Definition util.cpp:34
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:82
FuzzedDataProvider & fuzzed_data_provider
Definition fees.cpp:46
FakeNodeClock clock