Bitcoin Core  21.99.0
P2P Digital Currency
Public Member Functions | Static Public Member Functions | List of all members
PeerManager Class Referenceabstract

#include <net_processing.h>

Inheritance diagram for PeerManager:
[legend]
Collaboration diagram for PeerManager:
[legend]

Public Member Functions

virtual ~PeerManager ()
 
virtual bool GetNodeStateStats (NodeId nodeid, CNodeStateStats &stats)=0
 Get statistics from node state. More...
 
virtual bool IgnoresIncomingTxs ()=0
 Whether this node ignores txs received over p2p. More...
 
virtual void RelayTransaction (const uint256 &txid, const uint256 &wtxid) EXCLUSIVE_LOCKS_REQUIRED(cs_main)=0
 Relay transaction to all peers. More...
 
virtual void SendPings ()=0
 Send ping message to all peers. More...
 
virtual void SetBestHeight (int height)=0
 Set the best height. More...
 
virtual void Misbehaving (const NodeId pnode, const int howmuch, const std::string &message)=0
 Increment peer's misbehavior score. More...
 
virtual void CheckForStaleTipAndEvictPeers ()=0
 Evict extra outbound peers. More...
 
virtual void ProcessMessage (CNode &pfrom, const std::string &msg_type, CDataStream &vRecv, const std::chrono::microseconds time_received, const std::atomic< bool > &interruptMsgProc)=0
 Process a single message from a peer. More...
 
- Public Member Functions inherited from NetEventsInterface
virtual void InitializeNode (CNode *pnode)=0
 Initialize a peer (setup state, queue any initial messages) More...
 
virtual void FinalizeNode (const CNode &node)=0
 Handle removal of a peer (clear state) More...
 
virtual bool ProcessMessages (CNode *pnode, std::atomic< bool > &interrupt)=0
 Process protocol messages received from a given node. More...
 
virtual bool SendMessages (CNode *pnode) EXCLUSIVE_LOCKS_REQUIRED(pnode -> cs_sendProcessing)=0
 Send queued protocol messages to a given node. More...
 

Static Public Member Functions

static std::unique_ptr< PeerManagermake (const CChainParams &chainparams, CConnman &connman, CAddrMan &addrman, BanMan *banman, CScheduler &scheduler, ChainstateManager &chainman, CTxMemPool &pool, bool ignore_incoming_txs)
 

Additional Inherited Members

- Protected Member Functions inherited from CValidationInterface
 ~CValidationInterface ()=default
 Protected destructor so that instances can only be deleted by derived classes. More...
 
virtual void UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
 Notifies listeners when the block chain tip advances. More...
 
virtual void TransactionAddedToMempool (const CTransactionRef &tx, uint64_t mempool_sequence)
 Notifies listeners of a transaction having been added to mempool. More...
 
virtual void TransactionRemovedFromMempool (const CTransactionRef &tx, MemPoolRemovalReason reason, uint64_t mempool_sequence)
 Notifies listeners of a transaction leaving mempool. More...
 
virtual void BlockConnected (const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex)
 Notifies listeners of a block being connected. More...
 
virtual void BlockDisconnected (const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex)
 Notifies listeners of a block being disconnected. More...
 
virtual void ChainStateFlushed (const CBlockLocator &locator)
 Notifies listeners of the new active block chain on-disk. More...
 
virtual void BlockChecked (const CBlock &, const BlockValidationState &)
 Notifies listeners of a block validation result. More...
 
virtual void NewPoWValidBlock (const CBlockIndex *pindex, const std::shared_ptr< const CBlock > &block)
 Notifies listeners that a block which builds directly on our current tip has been received and connected to the headers tree, though not validated yet. More...
 
- Protected Member Functions inherited from NetEventsInterface
 ~NetEventsInterface ()=default
 Protected destructor so that instances can only be deleted by derived classes. More...
 

Detailed Description

Definition at line 37 of file net_processing.h.

Constructor & Destructor Documentation

◆ ~PeerManager()

virtual PeerManager::~PeerManager ( )
inlinevirtual

Definition at line 43 of file net_processing.h.

Member Function Documentation

◆ CheckForStaleTipAndEvictPeers()

virtual void PeerManager::CheckForStaleTipAndEvictPeers ( )
pure virtual

Evict extra outbound peers.

If we think our tip may be stale, connect to an extra outbound. Public for unit testing.

◆ GetNodeStateStats()

virtual bool PeerManager::GetNodeStateStats ( NodeId  nodeid,
CNodeStateStats stats 
)
pure virtual

Get statistics from node state.

◆ IgnoresIncomingTxs()

virtual bool PeerManager::IgnoresIncomingTxs ( )
pure virtual

Whether this node ignores txs received over p2p.

◆ make()

std::unique_ptr< PeerManager > PeerManager::make ( const CChainParams chainparams,
CConnman connman,
CAddrMan addrman,
BanMan banman,
CScheduler scheduler,
ChainstateManager chainman,
CTxMemPool pool,
bool  ignore_incoming_txs 
)
static

Definition at line 1253 of file net_processing.cpp.

Here is the caller graph for this function:

◆ Misbehaving()

virtual void PeerManager::Misbehaving ( const NodeId  pnode,
const int  howmuch,
const std::string &  message 
)
pure virtual

Increment peer's misbehavior score.

If the new value >= DISCOURAGEMENT_THRESHOLD, mark the node to be discouraged, meaning the peer might be disconnected and added to the discouragement filter. Public for unit testing.

◆ ProcessMessage()

virtual void PeerManager::ProcessMessage ( CNode pfrom,
const std::string &  msg_type,
CDataStream vRecv,
const std::chrono::microseconds  time_received,
const std::atomic< bool > &  interruptMsgProc 
)
pure virtual

Process a single message from a peer.

Public for fuzz testing

◆ RelayTransaction()

virtual void PeerManager::RelayTransaction ( const uint256 txid,
const uint256 wtxid 
)
pure virtual

Relay transaction to all peers.

◆ SendPings()

virtual void PeerManager::SendPings ( )
pure virtual

Send ping message to all peers.

◆ SetBestHeight()

virtual void PeerManager::SetBestHeight ( int  height)
pure virtual

Set the best height.


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