5 #include <chainparams.h> 27 static const auto testing_setup = MakeNoLogFileContext<>(
ChainType::MAIN);
35 node.SetCommonVersion(fuzzed_data_provider.ConsumeIntegral<
int>());
36 if (
const auto service_opt =
37 ConsumeDeserializable<CService>(fuzzed_data_provider, ConsumeDeserializationParams<CNetAddr::SerParams>(fuzzed_data_provider)))
39 node.SetAddrLocal(*service_opt);
45 node.CloseSocketDisconnect();
49 node.CopyStats(stats);
52 const CNode* add_ref_node =
node.AddRef();
56 if (
node.GetRefCount() > 0) {
63 node.ReceiveMsgBytes(b, complete);
67 (void)
node.GetAddrLocal();
69 (void)
node.GetLocalNonce();
70 const int ref_count =
node.GetRefCount();
72 (void)
node.GetCommonVersion();
75 (void)
node.HasPermission(net_permission_flags);
76 (void)
node.ConnectedThroughNetwork();
95 const bool added{
AddLocal(service, fuzzed_data_provider.ConsumeIntegralInRange<
int>(0,
LOCAL_MAX - 1))};
97 assert(service.IsRoutable());
CService GetLocalAddress(const CNode &peer)
WeakEnumType ConsumeWeakEnum(FuzzedDataProvider &fuzzed_data_provider, const WeakEnumType(&all_types)[size]) noexcept
constexpr NetPermissionFlags ALL_NET_PERMISSION_FLAGS[]
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
auto ConsumeNode(FuzzedDataProvider &fuzzed_data_provider, const std::optional< NodeId > &node_id_in=std::nullopt) noexcept
bool SeenLocal(const CService &addr)
vote for a local address
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
FUZZ_TARGET(net,.init=initialize_net)
bool AddLocal(const CService &addr_, int nScore)
CService ConsumeService(FuzzedDataProvider &fuzzed_data_provider) noexcept
A combination of a network address (CNetAddr) and a (TCP) port.
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
GlobalMutex g_maplocalhost_mutex
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
Information about a peer.
void RemoveLocal(const CService &addr)
bool IsLocal(const CService &addr)
check whether a given address is potentially local