6#include <chainparams.h>
53 }
catch (
const std::ios_base::failure&) {
94 for (
auto& entry : result) {
103 connman.Init(options);
147 assert(!connman.AddNode({node_str, fuzzed_data_provider.ConsumeBool()}));
221 const auto before{connman.GetLocalServices()};
223 connman.AddLocalServices(services);
224 assert((connman.GetLocalServices() & services) == services);
228 connman.RemoveLocalServices(services);
229 assert((connman.GetLocalServices() & services) == 0);
242 std::optional<Proxy> proxy_override;
247 connman.OpenNetworkConnection(
259 connman.CreateNodeFromAcceptedSocketPublic(
270 options.
vWhiteBinds = std::vector<NetWhitebindPermissions>{
282 connman.InitBindsPublic(options);
285 connman.SocketHandlerPublic();
294 (
void)connman.GetAddedNodeInfo(
false);
295 (
void)connman.GetExtraFullOutboundCount();
299 std::vector<CNodeStats> stats;
300 connman.GetNodeStats(stats);
301 const auto bytes_left{connman.GetOutboundTargetBytesLeft()};
306 assert(!connman.OutboundTargetReached(
false));
307 assert(!connman.OutboundTargetReached(
true));
311 (
void)connman.GetTryNewOutboundPeer();
313 (
void)connman.ASMapHealthCheck();
315 connman.ClearTestNodes();
static int32_t GetCheckRatio(const NodeContext &node_ctx)
const TestingSetup * g_setup
const CChainParams & Params()
Return the currently selected parameters.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
A CService with information about it as peer.
Information about a peer.
std::atomic_bool fSuccessfullyConnected
fSuccessfullyConnected is set to true on receiving VERACK from the peer.
Double ended buffer combining vector and stream-like interfaces.
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
Helper to initialize the global MockableSteadyClock, let a duration elapse, and reset it after use in...
std::string ConsumeRandomLengthString(size_t max_length)
T ConsumeIntegralInRange(T min, T max)
T PickValueInArray(const T(&array)[size])
ConnectionType
Different types of connections to a peer.
@ PRIVATE_BROADCAST
Private broadcast connections are short-lived and only opened to privacy networks (Tor,...
@ OUTBOUND_FULL_RELAY
These are the default connections that we use to connect with the network.
@ INBOUND
Inbound connections are those initiated by a peer.
void initialize_connman()
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
std::function< std::unique_ptr< Sock >(int, int, int)> CreateSock
Socket factory.
ServiceFlags
nServices flags
std::vector< NetWhitebindPermissions > vWhiteBinds
uint64_t nMaxOutboundLimit
std::vector< NetWhitelistPermissions > vWhitelistedRangeIncoming
std::vector< CService > onion_binds
NetEventsInterface * m_msgproc
std::vector< CService > vBinds
int m_max_automatic_connections
ServiceFlags m_local_services
bool m_use_addrman_outgoing
bool bind_on_any
True if the user did not specify -bind= or -whitebind= and thus we should bind on 0....
std::vector< NetWhitelistPermissions > vWhitelistedRangeOutgoing
Testing setup that configures a complete environment.
SeedRandomStateForTest(SeedRand::ZEROS)
CAddress ConsumeAddress(FuzzedDataProvider &fuzzed_data_provider) noexcept
CNetAddr ConsumeNetAddr(FuzzedDataProvider &fuzzed_data_provider, FastRandomContext *rand) noexcept
Create a CNetAddr.
CService ConsumeService(FuzzedDataProvider &fuzzed_data_provider) noexcept
CSubNet ConsumeSubNet(FuzzedDataProvider &fuzzed_data_provider) noexcept
NetGroupManager ConsumeNetGroupManager(FuzzedDataProvider &fuzzed_data_provider) noexcept
auto ConsumeNode(FuzzedDataProvider &fuzzed_data_provider, FakeSteadyClock &clock, const std::optional< NodeId > &node_id_in=std::nullopt) noexcept
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, FakeSteadyClock &clock, const std::optional< NodeId > &node_id_in=std::nullopt)
std::vector< CService > ConsumeServiceVector(FuzzedDataProvider &fuzzed_data_provider, size_t max_vector_size=5) noexcept
FuzzedNetEvents ConsumeNetEvents(FuzzedDataProvider &fdp) noexcept
std::shared_ptr< CThreadInterrupt > ConsumeThreadInterrupt(FuzzedDataProvider &fuzzed_data_provider)
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
WeakEnumType ConsumeWeakEnum(FuzzedDataProvider &fuzzed_data_provider, const WeakEnumType(&all_types)[size]) noexcept
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
constexpr ServiceFlags ALL_SERVICE_FLAGS[]
constexpr ConnectionType ALL_CONNECTION_TYPES[]
constexpr NetPermissionFlags ALL_NET_PERMISSION_FLAGS[]
@ ZEROS
Seed with a compile time constant of zeros.
std::string random_string(uint32_t length)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
FuzzedDataProvider & fuzzed_data_provider