diff options
author | Jon Atack <jon@atack.com> | 2020-12-17 18:49:30 +0100 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2020-12-17 18:49:30 +0100 |
commit | 23d8f346896c806581189c9eb870c7833c09f5be (patch) | |
tree | 9ab91f39af72abdbaf83ca043396d7ae04d0b572 /src/test/fuzz | |
parent | 143bd108ed6626405b0361c9939a8e1bf6cfc3d2 (diff) | |
download | bitcoin-23d8f346896c806581189c9eb870c7833c09f5be.tar.xz |
fuzz: replace CNode code with fuzz/util.h::ConsumeNode()
Diffstat (limited to 'src/test/fuzz')
-rw-r--r-- | src/test/fuzz/net.cpp | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/test/fuzz/net.cpp b/src/test/fuzz/net.cpp index 66d7c512e4..8c5f18e6b6 100644 --- a/src/test/fuzz/net.cpp +++ b/src/test/fuzz/net.cpp @@ -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)) { |