PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | Friends | List of all members
CNode Class Reference

Information about a peer. More...

#include <net.h>

Collaboration diagram for CNode:
[legend]

Public Member Functions

std::chrono::microseconds m_next_addr_send GUARDED_BY (cs_sendProcessing)
 
std::chrono::microseconds m_next_local_addr_send GUARDED_BY (cs_sendProcessing)
 
 CNode (NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const std::string &addrNameIn="", bool fInboundIn=false)
 
 ~CNode ()
 
 CNode (const CNode &)=delete
 
CNodeoperator= (const CNode &)=delete
 
NodeId GetId () const
 
uint64_t GetLocalNonce () const
 
int GetMyStartingHeight () const
 
int GetRefCount ()
 
unsigned int GetTotalRecvSize ()
 
bool ReceiveMsgBytes (const char *pch, unsigned int nBytes, bool &complete)
 
void SetRecvVersion (int nVersionIn)
 
int GetRecvVersion ()
 
void SetSendVersion (int nVersionIn)
 
int GetSendVersion () const
 
CService GetAddrLocal () const
 
void SetAddrLocal (const CService &addrLocalIn)
 May not be called more than once. More...
 
CNodeAddRef ()
 
void Release ()
 
void AddAddressKnown (const CAddress &_addr)
 
void PushAddress (const CAddress &_addr, FastRandomContext &insecure_rand)
 
void AddInventoryKnown (const CInv &inv)
 
void PushInventory (const CInv &inv)
 
void AskFor (const CInv &inv, int64_t doubleRequestDelay=2 *60 *1000000)
 
void AskForInvReceived (const uint256 &invHash)
 
void CloseSocketDisconnect ()
 
bool DisconnectOldProtocol (int nVersionIn, int nVersionRequired)
 
void copyStats (CNodeStats &stats, const std::vector< bool > &m_asmap)
 
ServiceFlags GetLocalServices () const
 
std::string GetAddrName () const
 
void MaybeSetAddrName (const std::string &addrNameIn)
 Sets the addrName only if it was not previously set. More...
 
bool CanRelay () const
 

Public Attributes

std::atomic< ServiceFlagsnServices
 
ServiceFlags nServicesExpected
 
SOCKET hSocket
 
size_t nSendSize
 
size_t nSendOffset
 
uint64_t nSendBytes
 
std::deque< std::vector< unsigned char > > vSendMsg
 
RecursiveMutex cs_vSend
 
RecursiveMutex cs_hSocket
 
RecursiveMutex cs_vRecv
 
RecursiveMutex cs_vProcessMsg
 
std::list< CNetMessagevProcessMsg
 
size_t nProcessQueueSize
 
RecursiveMutex cs_sendProcessing
 
std::deque< CInvvRecvGetData
 
uint64_t nRecvBytes
 
std::atomic< int > nRecvVersion
 
std::atomic< int64_t > nLastSend
 
std::atomic< int64_t > nLastRecv
 
const int64_t nTimeConnected
 
std::atomic< int64_t > nTimeOffset
 
const CAddress addr
 
std::atomic< int > nVersion
 
std::string strSubVer
 
std::string cleanSubVer
 
RecursiveMutex cs_SubVer
 
bool fWhitelisted
 
bool fFeeler
 
bool fOneShot
 
bool fAddnode
 
std::atomic< bool > m_masternode_connection {false}
 
std::atomic< bool > m_masternode_probe_connection {false}
 
std::atomic< bool > m_masternode_iqr_connection {false}
 
std::atomic< int64_t > m_last_wants_recsigs_recv {0}
 
bool fClient
 
const bool fInbound
 
std::atomic_bool m_wants_addrv2 {false}
 Whether the peer has signaled support for receiving ADDRv2 (BIP155) messages, implying a preference to receive ADDRv2 instead of ADDR ones. More...
 
std::atomic_bool fSuccessfullyConnected
 
std::atomic_bool fDisconnect
 
bool fRelayTxes
 
CSemaphoreGrant grantOutbound
 
RecursiveMutex cs_filter
 
std::unique_ptr< CBloomFilterpfilter
 
std::atomic< int > nRefCount
 
const uint64_t nKeyedNetGroup
 
std::atomic_bool fPauseRecv
 
std::atomic_bool fPauseSend
 
std::atomic< bool > m_wants_recsigs {false}
 
std::atomic< bool > fFirstMessageReceived {false}
 
std::atomic< bool > fFirstMessageIsMNAUTH {false}
 
uint256 hashContinue
 
std::atomic< int > nStartingHeight
 
std::vector< CAddressvAddrToSend
 
CRollingBloomFilter addrKnown
 
bool fGetAddr
 
std::set< uint256setKnown
 
double m_addr_token_bucket {10.0}
 Number of addresses that can be processed from this peer. More...
 
std::chrono::microseconds m_addr_token_timestamp {GetTime<std::chrono::microseconds>()}
 When m_addr_token_bucket was last updated. More...
 
CRollingBloomFilter filterInventoryKnown
 
std::set< uint256setInventoryTxToSend
 
std::vector< uint256vInventoryBlockToSend
 
std::vector< CInvvInventoryTierTwoToSend
 
RecursiveMutex cs_inventory
 
std::multimap< int64_t, CInvmapAskFor
 
std::set< uint256setAskFor
 
std::vector< uint256vBlockRequested
 
std::chrono::microseconds nNextInvSend {0}
 
bool fSendMempool
 
std::atomic< int64_t > timeLastMempoolReq {0}
 
std::atomic< uint64_t > nPingNonceSent
 
std::atomic< int64_t > nPingUsecStart
 
std::atomic< int64_t > nPingUsecTime
 
std::atomic< int64_t > nMinPingUsecTime
 
std::atomic< bool > fPingQueued
 
Mutex cs_mnauth
 
uint256 sentMNAuthChallenge
 
uint256 receivedMNAuthChallenge
 
uint256 verifiedProRegTxHash
 
uint256 verifiedPubKeyHash
 

Protected Attributes

mapMsgCmdSize mapSendBytesPerMsgCmd
 
mapMsgCmdSize mapRecvBytesPerMsgCmd
 

Private Attributes

const NodeId id
 
const uint64_t nLocalHostNonce
 
const ServiceFlags nLocalServices
 
const int nMyStartingHeight
 
int nSendVersion
 
std::list< CNetMessagevRecvMsg
 
RecursiveMutex cs_addrName
 
std::string addrName
 
CService addrLocal
 
RecursiveMutex cs_addrLocal
 

Friends

class CConnman
 

Detailed Description

Information about a peer.

Definition at line 668 of file net.h.

Constructor & Destructor Documentation

◆ CNode() [1/2]

CNode::CNode ( NodeId  id,
ServiceFlags  nLocalServicesIn,
int  nMyStartingHeightIn,
SOCKET  hSocketIn,
const CAddress addrIn,
uint64_t  nKeyedNetGroupIn,
uint64_t  nLocalHostNonceIn,
const std::string &  addrNameIn = "",
bool  fInboundIn = false 
)

Definition at line 2639 of file net.cpp.

◆ ~CNode()

CNode::~CNode ( )

Definition at line 2702 of file net.cpp.

Here is the call graph for this function:

◆ CNode() [2/2]

CNode::CNode ( const CNode )
delete

Member Function Documentation

◆ AddAddressKnown()

void CNode::AddAddressKnown ( const CAddress _addr)
inline

Definition at line 881 of file net.h.

Here is the call graph for this function:

◆ AddInventoryKnown()

void CNode::AddInventoryKnown ( const CInv inv)
inline

Definition at line 906 of file net.h.

Here is the call graph for this function:

◆ AddRef()

CNode* CNode::AddRef ( )
inline

Definition at line 869 of file net.h.

Here is the caller graph for this function:

◆ AskFor()

void CNode::AskFor ( const CInv inv,
int64_t  doubleRequestDelay = 2 * 60 * 1000000 
)

Definition at line 2707 of file net.cpp.

◆ AskForInvReceived()

void CNode::AskForInvReceived ( const uint256 invHash)

Definition at line 2741 of file net.cpp.

◆ CanRelay()

bool CNode::CanRelay ( ) const
inline

Definition at line 946 of file net.h.

Here is the caller graph for this function:

◆ CloseSocketDisconnect()

void CNode::CloseSocketDisconnect ( )

Definition at line 453 of file net.cpp.

Here is the call graph for this function:

◆ copyStats()

void CNode::copyStats ( CNodeStats stats,
const std::vector< bool > &  m_asmap 
)

Definition at line 665 of file net.cpp.

Here is the call graph for this function:

◆ DisconnectOldProtocol()

bool CNode::DisconnectOldProtocol ( int  nVersionIn,
int  nVersionRequired 
)

Definition at line 463 of file net.cpp.

◆ GetAddrLocal()

CService CNode::GetAddrLocal ( ) const

Definition at line 649 of file net.cpp.

Here is the caller graph for this function:

◆ GetAddrName()

std::string CNode::GetAddrName ( ) const

Definition at line 637 of file net.cpp.

Here is the caller graph for this function:

◆ GetId()

NodeId CNode::GetId ( ) const
inline

Definition at line 825 of file net.h.

Here is the caller graph for this function:

◆ GetLocalNonce()

uint64_t CNode::GetLocalNonce ( ) const
inline

Definition at line 830 of file net.h.

◆ GetLocalServices()

ServiceFlags CNode::GetLocalServices ( ) const
inline

Definition at line 937 of file net.h.

Here is the caller graph for this function:

◆ GetMyStartingHeight()

int CNode::GetMyStartingHeight ( ) const
inline

Definition at line 834 of file net.h.

◆ GetRecvVersion()

int CNode::GetRecvVersion ( )
inline

Definition at line 858 of file net.h.

◆ GetRefCount()

int CNode::GetRefCount ( )
inline

Definition at line 838 of file net.h.

◆ GetSendVersion()

int CNode::GetSendVersion ( ) const

Definition at line 789 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTotalRecvSize()

unsigned int CNode::GetTotalRecvSize ( )
inline

Definition at line 844 of file net.h.

◆ GUARDED_BY() [1/2]

std::chrono::microseconds m_next_addr_send CNode::GUARDED_BY ( cs_sendProcessing  )
inline

Definition at line 756 of file net.h.

◆ GUARDED_BY() [2/2]

std::chrono::microseconds m_next_local_addr_send CNode::GUARDED_BY ( cs_sendProcessing  )
inline

Definition at line 757 of file net.h.

◆ MaybeSetAddrName()

void CNode::MaybeSetAddrName ( const std::string &  addrNameIn)

Sets the addrName only if it was not previously set.

Definition at line 642 of file net.cpp.

◆ operator=()

CNode& CNode::operator= ( const CNode )
delete

◆ PushAddress()

void CNode::PushAddress ( const CAddress _addr,
FastRandomContext insecure_rand 
)
inline

Definition at line 886 of file net.h.

Here is the call graph for this function:

◆ PushInventory()

void CNode::PushInventory ( const CInv inv)
inline

Definition at line 914 of file net.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReceiveMsgBytes()

bool CNode::ReceiveMsgBytes ( const char *  pch,
unsigned int  nBytes,
bool &  complete 
)

Definition at line 724 of file net.cpp.

Here is the call graph for this function:

◆ Release()

void CNode::Release ( )
inline

Definition at line 875 of file net.h.

Here is the caller graph for this function:

◆ SetAddrLocal()

void CNode::SetAddrLocal ( const CService addrLocalIn)

May not be called more than once.

Definition at line 654 of file net.cpp.

Here is the call graph for this function:

◆ SetRecvVersion()

void CNode::SetRecvVersion ( int  nVersionIn)
inline

Definition at line 854 of file net.h.

◆ SetSendVersion()

void CNode::SetSendVersion ( int  nVersionIn)

Definition at line 775 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ CConnman

friend class CConnman
friend

Definition at line 670 of file net.h.

Member Data Documentation

◆ addr

const CAddress CNode::addr

Definition at line 698 of file net.h.

◆ addrKnown

CRollingBloomFilter CNode::addrKnown

Definition at line 753 of file net.h.

◆ addrLocal

CService CNode::addrLocal
private

Definition at line 822 of file net.h.

◆ addrName

std::string CNode::addrName
private

Definition at line 820 of file net.h.

◆ cleanSubVer

std::string CNode::cleanSubVer

Definition at line 704 of file net.h.

◆ cs_addrLocal

RecursiveMutex CNode::cs_addrLocal
mutableprivate

Definition at line 823 of file net.h.

◆ cs_addrName

RecursiveMutex CNode::cs_addrName
mutableprivate

Definition at line 819 of file net.h.

◆ cs_filter

RecursiveMutex CNode::cs_filter

Definition at line 729 of file net.h.

◆ cs_hSocket

RecursiveMutex CNode::cs_hSocket

Definition at line 681 of file net.h.

◆ cs_inventory

RecursiveMutex CNode::cs_inventory

Definition at line 775 of file net.h.

◆ cs_mnauth

Mutex CNode::cs_mnauth
mutable

Definition at line 799 of file net.h.

◆ cs_sendProcessing

RecursiveMutex CNode::cs_sendProcessing

Definition at line 688 of file net.h.

◆ cs_SubVer

RecursiveMutex CNode::cs_SubVer

Definition at line 705 of file net.h.

◆ cs_vProcessMsg

RecursiveMutex CNode::cs_vProcessMsg

Definition at line 684 of file net.h.

◆ cs_vRecv

RecursiveMutex CNode::cs_vRecv

Definition at line 682 of file net.h.

◆ cs_vSend

RecursiveMutex CNode::cs_vSend

Definition at line 680 of file net.h.

◆ fAddnode

bool CNode::fAddnode

Definition at line 709 of file net.h.

◆ fClient

bool CNode::fClient

Definition at line 714 of file net.h.

◆ fDisconnect

std::atomic_bool CNode::fDisconnect

Definition at line 722 of file net.h.

◆ fFeeler

bool CNode::fFeeler

Definition at line 707 of file net.h.

◆ fFirstMessageIsMNAUTH

std::atomic<bool> CNode::fFirstMessageIsMNAUTH {false}

Definition at line 742 of file net.h.

◆ fFirstMessageReceived

std::atomic<bool> CNode::fFirstMessageReceived {false}

Definition at line 740 of file net.h.

◆ fGetAddr

bool CNode::fGetAddr

Definition at line 754 of file net.h.

◆ filterInventoryKnown

CRollingBloomFilter CNode::filterInventoryKnown

Definition at line 765 of file net.h.

◆ fInbound

const bool CNode::fInbound

Definition at line 715 of file net.h.

◆ fOneShot

bool CNode::fOneShot

Definition at line 708 of file net.h.

◆ fPauseRecv

std::atomic_bool CNode::fPauseRecv

Definition at line 734 of file net.h.

◆ fPauseSend

std::atomic_bool CNode::fPauseSend

Definition at line 735 of file net.h.

◆ fPingQueued

std::atomic<bool> CNode::fPingQueued

Definition at line 796 of file net.h.

◆ fRelayTxes

bool CNode::fRelayTxes

Definition at line 727 of file net.h.

◆ fSendMempool

bool CNode::fSendMempool

Definition at line 781 of file net.h.

◆ fSuccessfullyConnected

std::atomic_bool CNode::fSuccessfullyConnected

Definition at line 721 of file net.h.

◆ fWhitelisted

bool CNode::fWhitelisted

Definition at line 706 of file net.h.

◆ grantOutbound

CSemaphoreGrant CNode::grantOutbound

Definition at line 728 of file net.h.

◆ hashContinue

uint256 CNode::hashContinue

Definition at line 748 of file net.h.

◆ hSocket

SOCKET CNode::hSocket

Definition at line 675 of file net.h.

◆ id

const NodeId CNode::id
private

Definition at line 811 of file net.h.

◆ m_addr_token_bucket

double CNode::m_addr_token_bucket {10.0}

Number of addresses that can be processed from this peer.

Start at 10 to permit self-announcement and starting peer propagation

Definition at line 760 of file net.h.

◆ m_addr_token_timestamp

std::chrono::microseconds CNode::m_addr_token_timestamp {GetTime<std::chrono::microseconds>()}

When m_addr_token_bucket was last updated.

Definition at line 762 of file net.h.

◆ m_last_wants_recsigs_recv

std::atomic<int64_t> CNode::m_last_wants_recsigs_recv {0}

Definition at line 713 of file net.h.

◆ m_masternode_connection

std::atomic<bool> CNode::m_masternode_connection {false}

Definition at line 710 of file net.h.

◆ m_masternode_iqr_connection

std::atomic<bool> CNode::m_masternode_iqr_connection {false}

Definition at line 712 of file net.h.

◆ m_masternode_probe_connection

std::atomic<bool> CNode::m_masternode_probe_connection {false}

Definition at line 711 of file net.h.

◆ m_wants_addrv2

std::atomic_bool CNode::m_wants_addrv2 {false}

Whether the peer has signaled support for receiving ADDRv2 (BIP155) messages, implying a preference to receive ADDRv2 instead of ADDR ones.

Definition at line 720 of file net.h.

◆ m_wants_recsigs

std::atomic<bool> CNode::m_wants_recsigs {false}

Definition at line 738 of file net.h.

◆ mapAskFor

std::multimap<int64_t, CInv> CNode::mapAskFor

Definition at line 776 of file net.h.

◆ mapRecvBytesPerMsgCmd

mapMsgCmdSize CNode::mapRecvBytesPerMsgCmd
protected

Definition at line 745 of file net.h.

◆ mapSendBytesPerMsgCmd

mapMsgCmdSize CNode::mapSendBytesPerMsgCmd
protected

Definition at line 744 of file net.h.

◆ nKeyedNetGroup

const uint64_t CNode::nKeyedNetGroup

Definition at line 733 of file net.h.

◆ nLastRecv

std::atomic<int64_t> CNode::nLastRecv

Definition at line 695 of file net.h.

◆ nLastSend

std::atomic<int64_t> CNode::nLastSend

Definition at line 694 of file net.h.

◆ nLocalHostNonce

const uint64_t CNode::nLocalHostNonce
private

Definition at line 812 of file net.h.

◆ nLocalServices

const ServiceFlags CNode::nLocalServices
private

Definition at line 814 of file net.h.

◆ nMinPingUsecTime

std::atomic<int64_t> CNode::nMinPingUsecTime

Definition at line 794 of file net.h.

◆ nMyStartingHeight

const int CNode::nMyStartingHeight
private

Definition at line 815 of file net.h.

◆ nNextInvSend

std::chrono::microseconds CNode::nNextInvSend {0}

Definition at line 779 of file net.h.

◆ nPingNonceSent

std::atomic<uint64_t> CNode::nPingNonceSent

Definition at line 788 of file net.h.

◆ nPingUsecStart

std::atomic<int64_t> CNode::nPingUsecStart

Definition at line 790 of file net.h.

◆ nPingUsecTime

std::atomic<int64_t> CNode::nPingUsecTime

Definition at line 792 of file net.h.

◆ nProcessQueueSize

size_t CNode::nProcessQueueSize

Definition at line 686 of file net.h.

◆ nRecvBytes

uint64_t CNode::nRecvBytes

Definition at line 691 of file net.h.

◆ nRecvVersion

std::atomic<int> CNode::nRecvVersion

Definition at line 692 of file net.h.

◆ nRefCount

std::atomic<int> CNode::nRefCount

Definition at line 731 of file net.h.

◆ nSendBytes

uint64_t CNode::nSendBytes

Definition at line 678 of file net.h.

◆ nSendOffset

size_t CNode::nSendOffset

Definition at line 677 of file net.h.

◆ nSendSize

size_t CNode::nSendSize

Definition at line 676 of file net.h.

◆ nSendVersion

int CNode::nSendVersion
private

Definition at line 816 of file net.h.

◆ nServices

std::atomic<ServiceFlags> CNode::nServices

Definition at line 673 of file net.h.

◆ nServicesExpected

ServiceFlags CNode::nServicesExpected

Definition at line 674 of file net.h.

◆ nStartingHeight

std::atomic<int> CNode::nStartingHeight

Definition at line 749 of file net.h.

◆ nTimeConnected

const int64_t CNode::nTimeConnected

Definition at line 696 of file net.h.

◆ nTimeOffset

std::atomic<int64_t> CNode::nTimeOffset

Definition at line 697 of file net.h.

◆ nVersion

std::atomic<int> CNode::nVersion

Definition at line 699 of file net.h.

◆ pfilter

std::unique_ptr<CBloomFilter> CNode::pfilter

Definition at line 730 of file net.h.

◆ receivedMNAuthChallenge

uint256 CNode::receivedMNAuthChallenge

Definition at line 801 of file net.h.

◆ sentMNAuthChallenge

uint256 CNode::sentMNAuthChallenge

Definition at line 800 of file net.h.

◆ setAskFor

std::set<uint256> CNode::setAskFor

Definition at line 777 of file net.h.

◆ setInventoryTxToSend

std::set<uint256> CNode::setInventoryTxToSend

Definition at line 768 of file net.h.

◆ setKnown

std::set<uint256> CNode::setKnown

Definition at line 755 of file net.h.

◆ strSubVer

std::string CNode::strSubVer

Definition at line 704 of file net.h.

◆ timeLastMempoolReq

std::atomic<int64_t> CNode::timeLastMempoolReq {0}

Definition at line 784 of file net.h.

◆ vAddrToSend

std::vector<CAddress> CNode::vAddrToSend

Definition at line 752 of file net.h.

◆ vBlockRequested

std::vector<uint256> CNode::vBlockRequested

Definition at line 778 of file net.h.

◆ verifiedProRegTxHash

uint256 CNode::verifiedProRegTxHash

Definition at line 802 of file net.h.

◆ verifiedPubKeyHash

uint256 CNode::verifiedPubKeyHash

Definition at line 803 of file net.h.

◆ vInventoryBlockToSend

std::vector<uint256> CNode::vInventoryBlockToSend

Definition at line 772 of file net.h.

◆ vInventoryTierTwoToSend

std::vector<CInv> CNode::vInventoryTierTwoToSend

Definition at line 774 of file net.h.

◆ vProcessMsg

std::list<CNetMessage> CNode::vProcessMsg

Definition at line 685 of file net.h.

◆ vRecvGetData

std::deque<CInv> CNode::vRecvGetData

Definition at line 690 of file net.h.

◆ vRecvMsg

std::list<CNetMessage> CNode::vRecvMsg
private

Definition at line 817 of file net.h.

◆ vSendMsg

std::deque<std::vector<unsigned char> > CNode::vSendMsg

Definition at line 679 of file net.h.


The documentation for this class was generated from the following files: