mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
fuzz: [refactor] Extract ALL_CONNECTION_TYPES constant
This commit is contained in:
parent
fa42da2d54
commit
faaef9434c
@ -22,6 +22,7 @@
|
||||
#include <streams.h>
|
||||
#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>
|
||||
@ -297,7 +298,7 @@ auto ConsumeNode(FuzzedDataProvider& fuzzed_data_provider, const std::optional<N
|
||||
const uint64_t local_host_nonce = fuzzed_data_provider.ConsumeIntegral<uint64_t>();
|
||||
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);
|
||||
|
@ -30,4 +30,13 @@ struct ConnmanTestMsg : public CConnman {
|
||||
bool ReceiveMsgFrom(CNode& node, CSerializedNetMsg& ser_msg) const;
|
||||
};
|
||||
|
||||
constexpr ConnectionType ALL_CONNECTION_TYPES[]{
|
||||
ConnectionType::INBOUND,
|
||||
ConnectionType::OUTBOUND_FULL_RELAY,
|
||||
ConnectionType::MANUAL,
|
||||
ConnectionType::FEELER,
|
||||
ConnectionType::BLOCK_RELAY,
|
||||
ConnectionType::ADDR_FETCH,
|
||||
};
|
||||
|
||||
#endif // BITCOIN_TEST_UTIL_NET_H
|
||||
|
Loading…
Reference in New Issue
Block a user