Drives the peer‐to‐peer message processing and relay logic for a node.
Synopsis
Declared in <net_processing.h>
class PeerManager
: public CValidationInterface
, public NetEventsInterface
Base Classes
Name |
Description |
Implement this to subscribe to events generated in validation and mempool |
|
Interface for message handling |
Types
Name |
Description |
Tunable options controlling peer manager behavior. |
Member Functions
Name |
Description |
|
Destroy the peer manager. |
|
Abort private broadcast attempts for transactions currently being privately broadcast. |
|
Evict extra outbound peers. If we think our tip may be stale, connect to an extra outbound. Public for unit testing. |
|
Attempt to manually fetch block from a given peer. We must already have the header. |
|
Handle removal of a peer (clear state). |
|
Gets the set of service flags which are "desirable" for a given peer. |
|
Get peer manager info. |
|
Get statistics from node state |
|
Get information about transactions currently held in the orphan pool. |
|
Get info about transactions currently being privately broadcast. |
|
Callback to determine whether the given set of service flags are sufficient for a peer to be "relevant". |
|
Initialize a peer (setup state). |
|
Initiate a private transaction broadcast. This is done asynchronously via short‐lived connections to peers on privacy networks. |
|
Initiate a transaction broadcast to eligible peers. Queue the witness transaction id to the inbound and outbound inv backlogs. Later, depending on |
|
Process protocol messages received from a given node |
|
Send queued protocol messages to a given node. |
|
Send ping message to all peers |
|
Set the height of the best block and its time (seconds since epoch). |
|
Begin running background tasks, should only be called once |
|
Apply misbehavior scoring to a peer directly. Public for unit testing. |
|
This function is used for testing the stale tip eviction logic, see denialofservice_tests.cpp |
Static Member Functions
Name |
Description |
Create a PeerManager instance wired to the node's networking and validation components. |
Static Data Members
Name |
Description |
Mutex for anything that is only accessed via the msg processing thread |
Protected Member Functions
Name |
Description |
|
Notifies listeners any time the block chain tip changes, synchronously. |
|
Notifies listeners of a block validation result. If the provided BlockValidationState IsValid, the provided block is guaranteed to be the current best block at the time the callback was generated (not necessarily now). |
|
Notifies listeners of a block being connected. |
|
Notifies listeners of a block being disconnected Provides the block that was disconnected. |
|
Notifies listeners of the new active block chain on‐disk. |
|
Notifies listeners of transactions removed from the mempool as as a result of new block being connected. MempoolTransactionsRemovedForBlock will be fired before BlockConnected. |
|
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. |
|
Notifies listeners of a transaction having been added to mempool. |
|
Notifies listeners of a transaction leaving mempool. |
|
Notifies listeners when the block chain tip advances. |
Non-Member Functions
Name |
Description |
Get the peer manager from a node context, asserting it is present. |
Created with MrDocs