MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CopyStats

Method CopyStats

src/net.cpp:622–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620#undef X
621#define X(name) stats.name = name
622void CNode::CopyStats(CNodeStats& stats)
623{
624 stats.nodeid = this->GetId();
625 X(addr);
626 X(addrBind);
627 stats.m_network = ConnectedThroughNetwork();
628 X(m_last_send);
629 X(m_last_recv);
630 X(m_last_tx_time);
631 X(m_last_block_time);
632 X(m_connected);
633 X(m_addr_name);
634 X(nVersion);
635 {
636 LOCK(m_subver_mutex);
637 X(cleanSubVer);
638 }
639 stats.fInbound = IsInboundConn();
640 X(m_bip152_highbandwidth_to);
641 X(m_bip152_highbandwidth_from);
642 {
643 LOCK(cs_vSend);
644 X(mapSendBytesPerMsgType);
645 X(nSendBytes);
646 }
647 {
648 LOCK(cs_vRecv);
649 X(mapRecvBytesPerMsgType);
650 X(nRecvBytes);
651 Transport::Info info = m_transport->GetInfo();
652 stats.m_transport_type = info.transport_type;
653 if (info.session_id) stats.m_session_id = HexStr(*info.session_id);
654 }
655 X(m_permission_flags);
656
657 X(m_last_ping_time);
658 X(m_min_ping_time);
659
660 // Leave string empty if addrLocal invalid (not filled in yet)
661 CService addrLocalUnlocked = GetAddrLocal();
662 stats.addrLocal = addrLocalUnlocked.IsValid() ? addrLocalUnlocked.ToStringAddrPort() : "";
663
664 X(m_conn_type);
665}
666#undef X
667
668bool CNode::ReceiveMsgBytes(std::span<const uint8_t> msg_bytes, bool& complete)

Callers 2

GetNodeStatsMethod · 0.80
net.cppFile · 0.80

Calls 5

GetIdMethod · 0.95
ToStringAddrPortMethod · 0.80
HexStrFunction · 0.50
GetInfoMethod · 0.45
IsValidMethod · 0.45

Tested by

no test coverage detected