52 node.addrman = std::make_unique<AddrMan>(
53 *
node.netgroupman,
true, 0);
58 .reconcile_txs = true,
59 .deterministic_rng = true,
61 connman.SetMsgProc(
node.peerman.get());
62 connman.SetAddrman(*
node.addrman);
66 std::vector<CNode*> peers;
68 for (
int i = 0; i < num_peers_to_add; ++i) {
70 connman.AddTestNode(*peers.back());
71 node.peerman->InitializeNode(
79 bool jump_out_of_ibd{
false};
88 if (!jump_out_of_ibd) jump_out_of_ibd = fuzzed_data_provider.
ConsumeBool();
89 if (jump_out_of_ibd && chainman.IsInitialBlockDownload()) chainman.JumpOutOfIbd();
91 clock += std::chrono::seconds{
93 -std::chrono::seconds{10min}.count(),
101 connman.FlushSendBuffer(connection);
102 (void)connman.ReceiveMsgFrom(connection, std::move(net_msg));
104 bool more_work{
true};
109 more_work = connman.ProcessMessagesOnce(connection);
110 }
catch (
const std::ios_base::failure&) {
112 node.peerman->SendMessages(connection);
116 node.connman->StopNodes();
const TestingSetup * g_setup
Information about a peer.
std::atomic_bool fSuccessfullyConnected
fSuccessfullyConnected is set to true on receiving VERACK from the peer.
std::atomic_bool fPauseSend
std::atomic_bool fDisconnect
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...
T ConsumeIntegralInRange(T min, T max)
static Mutex g_msgproc_mutex
Mutex for anything that is only accessed via the msg processing thread.
static std::unique_ptr< PeerManager > make(CConnman &connman, AddrMan &addrman, BanMan *banman, ChainstateManager &chainman, CTxMemPool &pool, node::Warnings &warnings, Options opts)
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
constexpr std::chrono::minutes TIMEOUT_INTERVAL
Time after which to disconnect, after waiting for a ping response (or inactivity).
constexpr unsigned int MAX_PROTOCOL_MESSAGE_LENGTH
Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable).
const std::array ALL_NET_MESSAGE_TYPES
All known message types (see above).
ServiceFlags
nServices flags
std::unique_ptr< T > MakeNoLogFileContext(const ChainType chain_type=ChainType::REGTEST, TestOpts opts={})
Make a test setup that has disk access to the debug.log file disabled.
std::vector< unsigned char > data
Testing setup that configures a complete environment.
SeedRandomStateForTest(SeedRand::ZEROS)
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, FakeSteadyClock &clock, const std::optional< NodeId > &node_id_in=std::nullopt)
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
@ ZEROS
Seed with a compile time constant of zeros.