[#CNode] = CNode :mrdocs: Information about a peer == Synopsis Declared in `<net.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class CNode; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:CNode/2constructor-0d.adoc[`CNode`] [.small]#[constructor]# | Constructors | xref:CNode/operator_assign.adoc[`operator=`] [.small]#[deleted]# | Deleted copy assignment; nodes are non‐copyable. | xref:CNode/AccountForSentBytes.adoc[`AccountForSentBytes`] | Account for the total size of a sent message in the per msg type connection stats. | xref:CNode/AddRef.adoc[`AddRef`] | Increment the reference count and return this node. | xref:CNode/AdvertisedVersion.adoc[`AdvertisedVersion`] | Protocol version advertised in our VERSION message. Private broadcast connections use a fixed version to maximise anonymity. | xref:CNode/CloseSocketDisconnect.adoc[`CloseSocketDisconnect`] | Close the socket and mark the connection as disconnected. | xref:CNode/ConnectedThroughNetwork.adoc[`ConnectedThroughNetwork`] | Get network the peer connected through. | xref:CNode/ConnectionTypeAsString.adoc[`ConnectionTypeAsString`] | Return the connection type as a human‐readable string. | xref:CNode/CopyStats.adoc[`CopyStats`] | Copy this node's current statistics into the given CNodeStats. | xref:CNode/DisconnectMsg.adoc[`DisconnectMsg`] | Helper function to log disconnects. | xref:CNode/ExpectServicesFromConn.adoc[`ExpectServicesFromConn`] | Whether we expect the peer to offer the services we want, given the connection type. | xref:CNode/GetAddrLocal.adoc[`GetAddrLocal`] | Return our local address as reported by this peer. | xref:CNode/GetCommonVersion.adoc[`GetCommonVersion`] | Return the greatest protocol version common to us and the peer. | xref:CNode/GetId.adoc[`GetId`] | Return this peer's unique identifier. | xref:CNode/GetLocalNonce.adoc[`GetLocalNonce`] | Return the local nonce used to detect connections to ourselves. | xref:CNode/GetRefCount.adoc[`GetRefCount`] | Return the current outstanding reference count for this node. | xref:CNode/HasPermission.adoc[`HasPermission`] | Return whether this peer has been granted the given permission flag. | xref:CNode/IsAddrFetchConn.adoc[`IsAddrFetchConn`] | Whether this is an address‐fetch connection. | xref:CNode/IsBlockOnlyConn.adoc[`IsBlockOnlyConn`] | Whether this is a block‐relay‐only connection. | xref:CNode/IsConnectedThroughPrivacyNet.adoc[`IsConnectedThroughPrivacyNet`] | Whether this peer connected through a privacy network. | xref:CNode/IsFeelerConn.adoc[`IsFeelerConn`] | Whether this is a feeler connection. | xref:CNode/IsFullOutboundConn.adoc[`IsFullOutboundConn`] | Whether this is an outbound full‐relay connection. | xref:CNode/IsInboundConn.adoc[`IsInboundConn`] | Whether this is an inbound connection. | xref:CNode/IsManualConn.adoc[`IsManualConn`] | Whether this is a manually added connection. | xref:CNode/IsManualOrFullOutboundConn.adoc[`IsManualOrFullOutboundConn`] | Whether this is a manual or outbound full‐relay connection. | xref:CNode/IsOutboundOrBlockRelayConn.adoc[`IsOutboundOrBlockRelayConn`] | Whether this is an outbound full‐relay or block‐relay‐only connection. | xref:CNode/IsPrivateBroadcastConn.adoc[`IsPrivateBroadcastConn`] | Whether this is a private broadcast connection. | xref:CNode/LogPeer.adoc[`LogPeer`] | Helper function to log the peer id, optionally including IP address. | xref:CNode/MarkReceivedMsgsForProcessing.adoc[`MarkReceivedMsgsForProcessing`] | Move all messages from the received queue to the processing queue. | xref:CNode/PollMessage.adoc[`PollMessage`] | Poll the next message from the processing queue of this connection. | xref:CNode/PongReceived.adoc[`PongReceived`] | A ping‐pong round trip has completed successfully. Update latest and minimum ping durations. | xref:CNode/ReceiveMsgBytes.adoc[`ReceiveMsgBytes`] | Receive bytes from the buffer and deserialize them into messages. | xref:CNode/Release.adoc[`Release`] | Decrement the reference count. | xref:CNode/SetAddrLocal.adoc[`SetAddrLocal`] | May not be called more than once | xref:CNode/SetCommonVersion.adoc[`SetCommonVersion`] | Record the greatest protocol version common to us and the peer. |=== == Data Members [cols="1,4"] |=== | Name| Description | xref:CNode/addr.adoc[`addr`] | Address of this peer. | xref:CNode/addrBind.adoc[`addrBind`] | Bind address of our side of the connection. | xref:CNode/cleanSubVer.adoc[`cleanSubVer`] | cleanSubVer is a sanitized string of the user agent byte array we read from the wire. This cleaned string can safely be logged or displayed. | xref:CNode/cs_vRecv.adoc[`cs_vRecv`] | Guards the receive‐side state. | xref:CNode/cs_vSend.adoc[`cs_vSend`] | Guards the send‐side state (vSendMsg, nSendBytes, etc.). | xref:CNode/fDisconnect.adoc[`fDisconnect`] | Setting this to true causes the node to be disconnected the next time DisconnectNodes() runs. | xref:CNode/fPauseRecv.adoc[`fPauseRecv`] | Whether receiving from this peer is currently paused (receive buffer full). | xref:CNode/fPauseSend.adoc[`fPauseSend`] | Whether sending to this peer is currently paused (send buffer full). | xref:CNode/fSuccessfullyConnected.adoc[`fSuccessfullyConnected`] | fSuccessfullyConnected is set to true on receiving VERACK from the peer. | xref:CNode/grantOutbound.adoc[`grantOutbound`] | Outbound connection slot grant held for the lifetime of the connection. | xref:CNode/m_addr_name.adoc[`m_addr_name`] | Human‐readable address or hostname of the peer. | xref:CNode/m_bip152_highbandwidth_from.adoc[`m_bip152_highbandwidth_from`] | The peer selected us as a (compact blocks) high‐bandwidth peer (BIP152). | xref:CNode/m_bip152_highbandwidth_to.adoc[`m_bip152_highbandwidth_to`] | We selected this peer as a (compact blocks) high‐bandwidth peer (BIP152). | xref:CNode/m_bloom_filter_loaded.adoc[`m_bloom_filter_loaded`] | Whether this peer has loaded a bloom filter. Used only in inbound eviction logic. | xref:CNode/m_conn_type.adoc[`m_conn_type`] | Type of this connection (inbound, outbound full relay, etc.). | xref:CNode/m_connected.adoc[`m_connected`] | Unix epoch time at peer connection | xref:CNode/m_dest.adoc[`m_dest`] | The pszDest argument provided to ConnectNode(). Only used for reconnections. | xref:CNode/m_has_all_wanted_services.adoc[`m_has_all_wanted_services`] | Whether this peer provides all services that we want. Used for eviction decisions | xref:CNode/m_inbound_onion.adoc[`m_inbound_onion`] | Whether this peer is an inbound onion, i.e. connected via our Tor onion service. | xref:CNode/m_last_block_time.adoc[`m_last_block_time`] | UNIX epoch time of the last block received from this peer that we had not yet seen (e.g. not already received from another peer), that passed preliminary validity checks and was saved to disk, even if we don't connect the block or it eventually fails to connect. Used as an inbound peer eviction criterion in CConnman::AttemptToEvictConnection. | xref:CNode/m_last_ping_time.adoc[`m_last_ping_time`] | Last measured round‐trip duration. Used only for stats. | xref:CNode/m_last_recv.adoc[`m_last_recv`] | Time of the last receive from this peer. | xref:CNode/m_last_send.adoc[`m_last_send`] | Time of the last send to this peer. | xref:CNode/m_last_tx_time.adoc[`m_last_tx_time`] | UNIX epoch time of the last transaction received from this peer that we had not yet seen (e.g. not already received from another peer) and that was accepted into our mempool. Used as an inbound peer eviction criterion in CConnman::AttemptToEvictConnection. | xref:CNode/m_min_ping_time.adoc[`m_min_ping_time`] | Lowest measured round‐trip duration. Used as an inbound peer eviction criterion in CConnman::AttemptToEvictConnection. | xref:CNode/m_network_key.adoc[`m_network_key`] | Network key used to prevent fingerprinting our node across networks. Influenced by the network and the bind address (+ bind port for inbounds) | xref:CNode/m_permission_flags.adoc[`m_permission_flags`] | Permission flags granted to this peer. | xref:CNode/m_prefer_evict.adoc[`m_prefer_evict`] | This peer is preferred for eviction. | xref:CNode/m_proxy_override.adoc[`m_proxy_override`] | Proxy to use regardless of global proxy settings if reconnecting to this node. | xref:CNode/m_relays_txs.adoc[`m_relays_txs`] | Whether we should relay transactions to this peer. This only changes from false to true. It will never change back to false. | xref:CNode/m_send_memusage.adoc[`m_send_memusage`] | Sum of GetMemoryUsage of all vSendMsg entries. | xref:CNode/m_sock.adoc[`m_sock`] | Socket used for communication with the node. May not own a Sock object (after `CloseSocketDisconnect()` or during tests). `shared_ptr` (instead of `unique_ptr`) is used to avoid premature close of the underlying file descriptor by one thread while another thread is poll(2)‐ing it for activity. | xref:CNode/m_sock_mutex.adoc[`m_sock_mutex`] | Guards access to m_sock and m_i2p_sam_session. | xref:CNode/m_subver_mutex.adoc[`m_subver_mutex`] | Guards cleanSubVer. | xref:CNode/m_transport.adoc[`m_transport`] | Transport serializer/deserializer. The receive side functions are only called under cs_vRecv, while the sending side functions are only called under cs_vSend. | xref:CNode/nKeyedNetGroup.adoc[`nKeyedNetGroup`] | Network group key used to bucket this peer for eviction and diversity. | xref:CNode/nRecvBytes.adoc[`nRecvBytes`] | Total number of bytes received on the wire from this peer. | xref:CNode/nRefCount.adoc[`nRefCount`] | Number of outstanding references to this node. | xref:CNode/nSendBytes.adoc[`nSendBytes`] | Total number of bytes sent on the wire to this peer. | xref:CNode/nVersion.adoc[`nVersion`] | Protocol version advertised by the peer (0 until received). | xref:CNode/vSendMsg.adoc[`vSendMsg`] | Messages still to be fed to m_transport‐>SetMessageToSend. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:GetLocalAddrForPeer.adoc[`GetLocalAddrForPeer`] | Returns a local address that we should advertise to this peer. | xref:GetLocalAddress.adoc[`GetLocalAddress`] | Return the best local address to use when talking to the given peer. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#