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);
49 peerman.SendMessages(&
node);
51 if (
node.fDisconnect)
return;
55 assert(peerman.GetNodeStateStats(
node.GetId(), statestats));
56 assert(statestats.m_relay_txs == (relay_txs && !
node.IsBlockOnlyConn()));
57 assert(statestats.their_services == remote_services);
58 if (successfully_connected) {
60 (void)connman.ReceiveMsgFrom(
node, msg_verack);
61 node.fPauseSend =
false;
62 connman.ProcessMessagesOnce(
node);
65 peerman.SendMessages(&
node);
73 assert(
node.ReceiveMsgBytes(msg_bytes, complete));
75 size_t nSizeAdded = 0;
76 auto it(
node.vRecvMsg.begin());
77 for (; it !=
node.vRecvMsg.end(); ++it) {
80 nSizeAdded += it->m_raw_message_size;
84 node.vProcessMsg.splice(
node.vProcessMsg.end(),
node.vRecvMsg,
node.vRecvMsg.begin(), it);
85 node.nProcessQueueSize += nSizeAdded;
93 std::vector<uint8_t> ser_msg_header;
94 node.m_serializer->prepareForTransport(ser_msg, ser_msg_header);
104 std::vector<NodeEvictionCandidate> candidates;
105 for (
int id = 0;
id < n_candidates; ++id) {
106 candidates.push_back({
108 std::chrono::seconds{random_context.
randrange(100)},
109 std::chrono::microseconds{random_context.
randrange(100)},
110 std::chrono::seconds{random_context.
randrange(100)},
111 std::chrono::seconds{random_context.
randrange(100)},
bool ReceiveMsgFrom(CNode &node, CSerializedNetMsg &ser_msg) const
ServiceFlags
nServices flags
Inbound connections are those initiated by a peer.
std::vector< unsigned char > data
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class...
A combination of a network address (CNetAddr) and a (TCP) port.
void NodeReceiveMsgBytes(CNode &node, Span< const uint8_t > msg_bytes, bool &complete) const
const char * VERACK
The verack message acknowledges a previously-received version message, informing the connecting node ...
const char * VERSION
The version message provides information about the transmitting node to the receiving node at the beg...
void Handshake(CNode &node, bool successfully_connected, ServiceFlags remote_services, ServiceFlags local_services, int32_t version, bool relay_txs)
static const int PROTOCOL_VERSION
network protocol versioning
bool randbool() noexcept
Generate a random boolean.
constexpr auto ALL_NETWORKS
std::vector< NodeEvictionCandidate > GetRandomNodeEvictionCandidates(int n_candidates, FastRandomContext &random_context)
A Span is an object that can refer to a contiguous sequence of objects.
Information about a peer.
uint64_t randrange(uint64_t range) noexcept
Generate a random integer in the range [0..range).