16 void ConnmanTestMsg::Handshake(
CNode&
node,
17 bool successfully_connected,
23 auto& peerman{
static_cast<PeerManager&
>(*m_msgproc)};
27 peerman.InitializeNode(
node, local_services);
44 (void)connman.ReceiveMsgFrom(
node, msg_version);
45 node.fPauseSend =
false;
46 connman.ProcessMessagesOnce(
node);
47 peerman.SendMessages(&
node);
48 if (
node.fDisconnect)
return;
52 assert(peerman.GetNodeStateStats(
node.GetId(), statestats));
55 if (successfully_connected) {
57 (void)connman.ReceiveMsgFrom(
node, msg_verack);
58 node.fPauseSend =
false;
59 connman.ProcessMessagesOnce(
node);
60 peerman.SendMessages(&
node);
67 assert(
node.ReceiveMsgBytes(msg_bytes, complete));
69 size_t nSizeAdded = 0;
70 for (
const auto& msg :
node.vRecvMsg) {
73 nSizeAdded += msg.m_raw_message_size;
77 node.vProcessMsg.splice(
node.vProcessMsg.end(),
node.vRecvMsg);
78 node.nProcessQueueSize += nSizeAdded;
86 std::vector<uint8_t> ser_msg_header;
87 node.m_serializer->prepareForTransport(ser_msg, ser_msg_header);
97 std::vector<NodeEvictionCandidate> candidates;
98 for (
int id = 0;
id < n_candidates; ++id) {
99 candidates.push_back({
101 std::chrono::seconds{random_context.
randrange(100)},
102 std::chrono::microseconds{random_context.
randrange(100)},
103 std::chrono::seconds{random_context.
randrange(100)},
104 std::chrono::seconds{random_context.
randrange(100)},
Information about a peer.
A combination of a network address (CNetAddr) and a (TCP) port.
bool randbool() noexcept
Generate a random boolean.
uint64_t randrange(uint64_t range) noexcept
Generate a random integer in the range [0..range).
A Span is an object that can refer to a contiguous sequence of objects.
@ INBOUND
Inbound connections are those initiated by a peer.
const char * VERSION
The version message provides information about the transmitting node to the receiving node at the beg...
const char * VERACK
The verack message acknowledges a previously-received version message, informing the connecting node ...
ServiceFlags
nServices flags
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class.
ServiceFlags their_services
std::vector< unsigned char > data
bool ReceiveMsgFrom(CNode &node, CSerializedNetMsg &ser_msg) const
void NodeReceiveMsgBytes(CNode &node, Span< const uint8_t > msg_bytes, bool &complete) const
std::vector< NodeEvictionCandidate > GetRandomNodeEvictionCandidates(int n_candidates, FastRandomContext &random_context)
constexpr auto ALL_NETWORKS
static const int PROTOCOL_VERSION
network protocol versioning