Bitcoin Core 22.99.0
P2P Digital Currency
policy_estimator_io.cpp
Go to the documentation of this file.
1// Copyright (c) 2020-2021 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 <policy/fees.h>
7#include <test/fuzz/fuzz.h>
8#include <test/fuzz/util.h>
10
11#include <cstdint>
12#include <vector>
13
15{
16 static const auto testing_setup = MakeNoLogFileContext<>();
17}
18
20{
21 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
22 FuzzedAutoFileProvider fuzzed_auto_file_provider = ConsumeAutoFile(fuzzed_data_provider);
23 CAutoFile fuzzed_auto_file = fuzzed_auto_file_provider.open();
24 // Re-using block_policy_estimator across runs to avoid costly creation of CBlockPolicyEstimator object.
25 static CBlockPolicyEstimator block_policy_estimator;
26 if (block_policy_estimator.Read(fuzzed_auto_file)) {
27 block_policy_estimator.Write(fuzzed_auto_file);
28 }
29}
Non-refcounted RAII wrapper for FILE*.
Definition: streams.h:565
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
Definition: fees.h:132
bool Read(CAutoFile &filein)
Read estimation data from a file.
Definition: fees.cpp:919
bool Write(CAutoFile &fileout) const
Write estimation data to a file.
Definition: fees.cpp:894
CAutoFile open()
Definition: util.h:316
FUZZ_TARGET_INIT(policy_estimator_io, initialize_policy_estimator_io)
void initialize_policy_estimator_io()
FuzzedAutoFileProvider ConsumeAutoFile(FuzzedDataProvider &fuzzed_data_provider) noexcept
Definition: util.h:322