mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Merge #20686: fuzz, refactor: replace CNode code with fuzz/util.h::ConsumeNode()
23d8f34689
fuzz: replace CNode code with fuzz/util.h::ConsumeNode() (Jon Atack) Pull request description: Noticed this while updating the CNode fuzzing in #20210. -cc26fab48d
created `test/fuzz/net.cpp` in May 2020 -79ef8324d4
created a CNode factory utility `test/fuzz/util.h::ConsumeNode()` in October 2020 This PR updates `fuzz/net.cpp` from the first commit to use `ConsumeNode()` from the second commit. ACKs for top commit: MarcoFalke: ACK23d8f34689
Tree-SHA512: 26f7685395b3d48fcf40dde0d479d5c2fb4e953ec9371940b19eee16bb30aee4840b081e1a918b924a9704c1bef484302ea3e8fe63819a3bba73e7eb805164f1
This commit is contained in:
commit
b7136c11ab
1 changed files with 1 additions and 20 deletions
|
@ -28,26 +28,7 @@ FUZZ_TARGET_INIT(net, initialize_net)
|
|||
{
|
||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||
SetMockTime(ConsumeTime(fuzzed_data_provider));
|
||||
const std::optional<CAddress> address = ConsumeDeserializable<CAddress>(fuzzed_data_provider);
|
||||
if (!address) {
|
||||
return;
|
||||
}
|
||||
const std::optional<CAddress> address_bind = ConsumeDeserializable<CAddress>(fuzzed_data_provider);
|
||||
if (!address_bind) {
|
||||
return;
|
||||
}
|
||||
|
||||
CNode node{fuzzed_data_provider.ConsumeIntegral<NodeId>(),
|
||||
static_cast<ServiceFlags>(fuzzed_data_provider.ConsumeIntegral<uint64_t>()),
|
||||
fuzzed_data_provider.ConsumeIntegral<int>(),
|
||||
INVALID_SOCKET,
|
||||
*address,
|
||||
fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
|
||||
fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
|
||||
*address_bind,
|
||||
fuzzed_data_provider.ConsumeRandomLengthString(32),
|
||||
fuzzed_data_provider.PickValueInArray({ConnectionType::INBOUND, ConnectionType::OUTBOUND_FULL_RELAY, ConnectionType::MANUAL, ConnectionType::FEELER, ConnectionType::BLOCK_RELAY, ConnectionType::ADDR_FETCH}),
|
||||
fuzzed_data_provider.ConsumeBool()};
|
||||
CNode node{ConsumeNode(fuzzed_data_provider)};
|
||||
node.SetCommonVersion(fuzzed_data_provider.ConsumeIntegral<int>());
|
||||
while (fuzzed_data_provider.ConsumeBool()) {
|
||||
switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 10)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue