| 620 | #undef X |
| 621 | #define X(name) stats.name = name |
| 622 | void CNode::CopyStats(CNodeStats& stats) |
| 623 | { |
| 624 | stats.nodeid = this->GetId(); |
| 625 | X(nServices); |
| 626 | X(addr); |
| 627 | X(addrBind); |
| 628 | stats.m_network = ConnectedThroughNetwork(); |
| 629 | if (m_tx_relay != nullptr) { |
| 630 | LOCK(m_tx_relay->cs_filter); |
| 631 | stats.fRelayTxes = m_tx_relay->fRelayTxes; |
| 632 | } else { |
| 633 | stats.fRelayTxes = false; |
| 634 | } |
| 635 | X(m_last_send); |
| 636 | X(m_last_recv); |
| 637 | X(m_last_tx_time); |
| 638 | X(m_last_block_time); |
| 639 | X(m_connected); |
| 640 | X(nTimeOffset); |
| 641 | X(m_addr_name); |
| 642 | X(nVersion); |
| 643 | { |
| 644 | LOCK(m_subver_mutex); |
| 645 | X(cleanSubVer); |
| 646 | } |
| 647 | stats.fInbound = IsInboundConn(); |
| 648 | X(m_bip152_highbandwidth_to); |
| 649 | X(m_bip152_highbandwidth_from); |
| 650 | { |
| 651 | LOCK(cs_vSend); |
| 652 | X(mapSendBytesPerMsgCmd); |
| 653 | X(nSendBytes); |
| 654 | } |
| 655 | { |
| 656 | LOCK(cs_vRecv); |
| 657 | X(mapRecvBytesPerMsgCmd); |
| 658 | X(nRecvBytes); |
| 659 | } |
| 660 | X(m_permissionFlags); |
| 661 | if (m_tx_relay != nullptr) { |
| 662 | stats.minFeeFilter = m_tx_relay->minFeeFilter; |
| 663 | } else { |
| 664 | stats.minFeeFilter = 0; |
| 665 | } |
| 666 | |
| 667 | X(m_last_ping_time); |
| 668 | X(m_min_ping_time); |
| 669 | |
| 670 | // Leave string empty if addrLocal invalid (not filled in yet) |
| 671 | CService addrLocalUnlocked = GetAddrLocal(); |
| 672 | stats.addrLocal = addrLocalUnlocked.IsValid() ? addrLocalUnlocked.ToString() : ""; |
| 673 | |
| 674 | X(m_conn_type); |
| 675 | } |
| 676 | #undef X |
| 677 | |
| 678 | bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete) |