34 static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(
36 g_setup = testing_setup.get();
51 AddrMan addrman{netgroupman,
true, 0};
56 .reconcile_txs = true,
57 .deterministic_rng = true,
59 connman.SetMsgProc(peerman.get());
63 std::vector<CNode*> peers;
64 const auto num_peers_to_add = fuzzed_data_provider.ConsumeIntegralInRange(1, 3);
65 for (
int i = 0; i < num_peers_to_add; ++i) {
67 connman.AddTestNode(*peers.back());
68 peerman->InitializeNode(
70 static_cast<ServiceFlags>(fuzzed_data_provider.ConsumeIntegral<uint64_t>()));
83 fuzzed_data_provider.ConsumeIntegralInRange<int64_t>(
84 -std::chrono::seconds{10min}.count(),
91 connman.FlushSendBuffer(connection);
92 (void)connman.ReceiveMsgFrom(connection, std::move(net_msg));
99 more_work = connman.ProcessMessagesOnce(connection);
100 }
catch (
const std::ios_base::failure&) {
102 peerman->SendMessages(&connection);
static Mutex g_msgproc_mutex
Mutex for anything that is only accessed via the msg processing thread.
std::atomic_bool fPauseSend
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH
Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable).
ServiceFlags
nServices flags
Manages warning messages within a node.
std::vector< unsigned char > data
static std::unique_ptr< PeerManager > make(CConnman &connman, AddrMan &addrman, BanMan *banman, ChainstateManager &chainman, CTxMemPool &pool, node::Warnings &warnings, Options opts)
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, const std::optional< NodeId > &node_id_in=std::nullopt)
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
FUZZ_TARGET(p2p_handshake,.init=::initialize)
static constexpr std::chrono::minutes TIMEOUT_INTERVAL
Time after which to disconnect, after waiting for a ping response (or inactivity).
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
Stochastic address manager.
std::unique_ptr< CTxMemPool > mempool
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
std::atomic_bool fDisconnect
const std::array ALL_NET_MESSAGE_TYPES
All known message types (see above).
std::atomic_bool fSuccessfullyConnected
fSuccessfullyConnected is set to true on receiving VERACK from the peer.
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
std::unique_ptr< CConnman > connman
Information about a peer.
int64_t GetTime()
DEPRECATED, see GetTime.
std::unique_ptr< ChainstateManager > chainman
Testing setup that configures a complete environment.