67 node.addrman = std::make_unique<AddrMan>(
68 *
node.netgroupman,
true, 0);
73 .reconcile_txs = true,
74 .deterministic_rng = true,
76 connman.SetMsgProc(
node.peerman.get());
77 connman.SetAddrman(*
node.addrman);
83 for (
int i = 0; i <
num_txs; ++i) {
85 (
void)
node.peerman->InitiateTxBroadcastPrivate(tx);
93 std::vector<CNode*> peers;
111 connman.SetCaptureMessages(
true);
150 std::vector<CInv>
invs;
173 connman.AddTestNode(*peers.back());
174 node.peerman->InitializeNode(
187 std::optional<CSerializedNetMsg>
net_msg;
199 (
void)
node.peerman->InitiateTxBroadcastPrivate(
204 if (
p2p_node.IsPrivateBroadcastConn() &&
210 std::vector<CInv>{{
MSG_TX, tx->GetHash().ToUint256()}}));
222 if (!
p2p_node.IsPrivateBroadcastConn() &&
247 }
catch (
const std::ios_base::failure&) {
255 connman.SetCaptureMessages(
false);
257 node.connman->StopNodes();
const TestingSetup * g_setup
#define Assert(val)
Identity function.
A CService with information about it as peer.
static constexpr SerParams V1
Information about a peer.
A combination of a network address (CNetAddr) and a (TCP) port.
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)
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)
Minimal stream for reading from an existing byte array by std::span.
static const PrecomputedData data
Precomputed COutPoint and CCoins values.
@ PRIVATE_BROADCAST
Private broadcast connections are short-lived and only opened to privacy networks (Tor,...
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
CSerializedNetMsg Make(std::string msg_type, Args &&... args)
constexpr const char * PONG
The pong message replies to a ping message, proving to the pinging node that the ponging node is stil...
constexpr const char * PING
The ping message is sent periodically to help confirm that the receiving peer is still connected.
constexpr const char * VERACK
The verack message acknowledges a previously-received version message, informing the connecting node ...
constexpr const char * GETDATA
The getdata message requests one or more data objects from another node.
constexpr const char * INV
The inv message (inventory message) transmits one or more inventories of objects known to the transmi...
constexpr const char * TX
The tx message transmits a single transaction.
constexpr const char * VERSION
The version message provides information about the transmitting node to the receiving node at the beg...
std::function< void(const CAddress &addr, const std::string &msg_type, std::span< const unsigned char > data, bool is_incoming)> CaptureMessage
Defaults to CaptureMessageToFile(), but can be overridden by unit tests.
constexpr unsigned int MAX_PROTOCOL_MESSAGE_LENGTH
Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable).
constexpr TransactionSerParams TX_WITH_WITNESS
static CTransactionRef MakeTransactionRef(Tx &&txIn)
ServiceFlags
nServices flags
constexpr int PROTOCOL_VERSION
network protocol versioning
constexpr int WTXID_RELAY_VERSION
"wtxidrelay" message type for wtxid-based relay starts with this version
void Reset()
Reset the internal state.
Testing setup that configures a complete environment.
SeedRandomStateForTest(SeedRand::ZEROS)
CAddress ConsumeAddress(FuzzedDataProvider &fuzzed_data_provider) noexcept
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, FakeSteadyClock &clock, const std::optional< NodeId > &node_id_in=std::nullopt)
CMutableTransaction ConsumeTransaction(FuzzedDataProvider &fuzzed_data_provider, const std::optional< std::vector< Txid > > &prevout_txids, const int max_num_in, const int max_num_out) 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
@ ZEROS
Seed with a compile time constant of zeros.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
FuzzedDataProvider & fuzzed_data_provider