Bitcoin Core
31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
src
test
fuzz
protocol.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 <protocol.h>
6
#include <
test/fuzz/FuzzedDataProvider.h
>
7
#include <
test/fuzz/fuzz.h
>
8
#include <
test/fuzz/util.h
>
9
10
#include <cstdint>
11
#include <optional>
12
#include <stdexcept>
13
#include <vector>
14
15
FUZZ_TARGET
(
protocol
)
16
{
17
FuzzedDataProvider
fuzzed_data_provider
(buffer.data(), buffer.size());
18
const
std::optional<CInv> inv =
ConsumeDeserializable<CInv>
(
fuzzed_data_provider
);
19
if
(!inv) {
20
return
;
21
}
22
try
{
23
(
void
)inv->GetMessageType();
24
}
catch
(
const
std::out_of_range&) {
25
}
26
(
void
)inv->ToString();
27
const
std::optional<CInv>
another_inv
=
ConsumeDeserializable<CInv>
(
fuzzed_data_provider
);
28
if
(!
another_inv
) {
29
return
;
30
}
31
(
void
)(*inv < *
another_inv
);
32
}
FuzzedDataProvider.h
FuzzedDataProvider
Definition
FuzzedDataProvider.h:32
fuzz.h
FUZZ_TARGET
#define FUZZ_TARGET(...)
Definition
fuzz.h:35
util.h
Ticks
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition
time.h:73
fuzzed_data_provider
FuzzedDataProvider & fuzzed_data_provider
Definition
fees.cpp:38
Generated on Thu Apr 16 2026 09:42:38 for Bitcoin Core by
1.10.0