mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
Merge bitcoin#20789: Rework strong and weak net enum fuzzing
missing faaef94
This commit is contained in:
parent
4a3e3af6e7
commit
83313a5603
@ -24,6 +24,7 @@
|
||||
#include <test/fuzz/FuzzedDataProvider.h>
|
||||
#include <test/fuzz/fuzz.h>
|
||||
#include <test/util/net.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <txmempool.h>
|
||||
#include <uint256.h>
|
||||
#include <util/overflow.h>
|
||||
@ -317,7 +318,7 @@ auto ConsumeNode(FuzzedDataProvider& fuzzed_data_provider, const std::optional<N
|
||||
const CAddress addr_bind = ConsumeAddress(fuzzed_data_provider);
|
||||
const std::string addr_name = fuzzed_data_provider.ConsumeRandomLengthString(64);
|
||||
|
||||
const ConnectionType conn_type = fuzzed_data_provider.PickValueInArray({ConnectionType::INBOUND, ConnectionType::OUTBOUND_FULL_RELAY, ConnectionType::MANUAL, ConnectionType::FEELER, ConnectionType::BLOCK_RELAY, ConnectionType::ADDR_FETCH});
|
||||
const ConnectionType conn_type = fuzzed_data_provider.PickValueInArray(ALL_CONNECTION_TYPES);
|
||||
const bool inbound_onion{conn_type == ConnectionType::INBOUND ? fuzzed_data_provider.ConsumeBool() : false};
|
||||
if constexpr (ReturnUniquePtr) {
|
||||
return std::make_unique<CNode>(node_id, local_services, socket, address, keyed_net_group, local_host_nonce, addr_bind, addr_name, conn_type, inbound_onion);
|
||||
|
@ -58,6 +58,15 @@ constexpr NetPermissionFlags ALL_NET_PERMISSION_FLAGS[]{
|
||||
NetPermissionFlags::All,
|
||||
};
|
||||
|
||||
constexpr ConnectionType ALL_CONNECTION_TYPES[]{
|
||||
ConnectionType::INBOUND,
|
||||
ConnectionType::OUTBOUND_FULL_RELAY,
|
||||
ConnectionType::MANUAL,
|
||||
ConnectionType::FEELER,
|
||||
ConnectionType::BLOCK_RELAY,
|
||||
ConnectionType::ADDR_FETCH,
|
||||
};
|
||||
|
||||
/**
|
||||
* A mocked Sock alternative that returns a statically contained data upon read and succeeds
|
||||
* and ignores all writes. The data to be returned is given to the constructor and when it is
|
||||
|
Loading…
Reference in New Issue
Block a user