![]() |
Bitcoin Core 31.99.0
P2P Digital Currency
|
#include <net_processing.h>
Classes | |
| struct | Options |
Public Member Functions | |
| virtual | ~PeerManager ()=default |
| virtual util::Expected< void, std::string > | FetchBlock (NodeId peer_id, const CBlockIndex &block_index)=0 |
| Attempt to manually fetch block from a given peer. More... | |
| virtual void | StartScheduledTasks (CScheduler &scheduler)=0 |
| Begin running background tasks, should only be called once. More... | |
| virtual bool | GetNodeStateStats (NodeId nodeid, CNodeStateStats &stats) const =0 |
| Get statistics from node state. More... | |
| virtual std::vector< node::TxOrphanage::OrphanInfo > | GetOrphanTransactions ()=0 |
| virtual PeerManagerInfo | GetInfo () const =0 |
| Get peer manager info. More... | |
| virtual std::vector< PrivateBroadcast::TxBroadcastInfo > | GetPrivateBroadcastInfo () const =0 |
| Get info about transactions currently being privately broadcast. More... | |
| virtual std::vector< CTransactionRef > | AbortPrivateBroadcast (const uint256 &id)=0 |
| Abort private broadcast attempts for transactions currently being privately broadcast. More... | |
| virtual void | InitiateTxBroadcastToAll (const Wtxid &wtxid)=0 |
| Initiate a transaction broadcast to eligible peers. More... | |
| virtual node::TransactionError | InitiateTxBroadcastPrivate (const CTransactionRef &tx)=0 |
| Initiate a private transaction broadcast. More... | |
| virtual void | SendPings ()=0 |
| Send ping message to all peers. More... | |
| virtual void | SetBestBlock (int height, std::chrono::seconds time)=0 |
| Set the height of the best block and its time (seconds since epoch). More... | |
| virtual void | UnitTestMisbehaving (NodeId peer_id)=0 |
| virtual void | CheckForStaleTipAndEvictPeers ()=0 |
| Evict extra outbound peers. More... | |
| virtual void | UpdateLastBlockAnnounceTime (NodeId node, int64_t time_in_seconds)=0 |
| This function is used for testing the stale tip eviction logic, see denialofservice_tests.cpp. More... | |
| virtual ServiceFlags | GetDesirableServiceFlags (ServiceFlags services) const =0 |
| Gets the set of service flags which are "desirable" for a given peer. More... | |
Public Member Functions inherited from NetEventsInterface | |
| virtual void | InitializeNode (const CNode &node, ServiceFlags our_services)=0 |
| Initialize a peer (setup state) More... | |
| virtual void | FinalizeNode (const CNode &node)=0 |
| Handle removal of a peer (clear state) More... | |
| virtual bool | HasAllDesirableServiceFlags (ServiceFlags services) const =0 |
| Callback to determine whether the given set of service flags are sufficient for a peer to be "relevant". More... | |
| virtual bool | ProcessMessages (CNode &node, std::atomic< bool > &interrupt) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex)=0 |
| Process protocol messages received from a given node. More... | |
| virtual bool | SendMessages (CNode &node) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex)=0 |
| Send queued protocol messages to a given node. More... | |
Static Public Member Functions | |
| static std::unique_ptr< PeerManager > | make (CConnman &connman, AddrMan &addrman, BanMan *banman, ChainstateManager &chainman, CTxMemPool &pool, node::Warnings &warnings, Options opts) |
Additional Inherited Members | |
Static Public Attributes inherited from NetEventsInterface | |
| static Mutex | g_msgproc_mutex |
| Mutex for anything that is only accessed via the msg processing thread. More... | |
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 | ActiveTipChange (const CBlockIndex &new_tip, bool is_ibd) |
| Notifies listeners any time the block chain tip changes, synchronously. More... | |
| virtual void | TransactionAddedToMempool (const NewMempoolTransactionInfo &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 | MempoolTransactionsRemovedForBlock (const std::vector< RemovedMempoolTransactionInfo > &txs_removed_for_block, unsigned int nBlockHeight) |
| virtual void | BlockConnected (const kernel::ChainstateRole &role, 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 Provides the block that was disconnected. More... | |
| virtual void | ChainStateFlushed (const kernel::ChainstateRole &role, const CBlockLocator &locator) |
| Notifies listeners of the new active block chain on-disk. More... | |
| virtual void | BlockChecked (const std::shared_ptr< 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... | |
Definition at line 89 of file net_processing.h.
|
virtualdefault |
|
pure virtual |
Abort private broadcast attempts for transactions currently being privately broadcast.
| [in] | id | A transaction identifier. It will be matched against both txid and wtxid for all transactions in the private broadcast queue. |
|
pure virtual |
Evict extra outbound peers.
If we think our tip may be stale, connect to an extra outbound. Public for unit testing.
|
pure virtual |
Attempt to manually fetch block from a given peer.
We must already have the header.
| [in] | peer_id | The peer id |
| [in] | block_index | The blockindex |
|
pure virtual |
Gets the set of service flags which are "desirable" for a given peer.
These are the flags which are required for a peer to support for them to be "interesting" to us, ie for us to wish to use one of our few outbound connection slots for or for us to wish to prioritize keeping their connection around.
Relevant service flags may be peer- and state-specific in that the version of the peer may determine which flags are required (eg in the case of NODE_NETWORK_LIMITED where we seek out NODE_NETWORK peers unless they set NODE_NETWORK_LIMITED and we are out of IBD, in which case NODE_NETWORK_LIMITED suffices).
Thus, generally, avoid calling with 'services' == NODE_NONE, unless state-specific flags must absolutely be avoided. When called with 'services' == NODE_NONE, the returned desirable service flags are guaranteed to not change dependent on state - ie they are suitable for use when describing peers which we know to be desirable, but for which we do not have a confirmed set of service flags.
|
pure virtual |
Get peer manager info.
|
pure virtual |
Get statistics from node state.
|
pure virtual |
|
pure virtual |
Get info about transactions currently being privately broadcast.
|
pure virtual |
Initiate a private transaction broadcast.
This is done asynchronously via short-lived connections to peers on privacy networks.
| node::TransactionError::OK | The transaction is scheduled for private broadcast (or was already scheduled). |
| node::TransactionError::PRIVATE_BROADCAST_FULL | Rejected because the private broadcast queue is full. |
|
pure virtual |
Initiate a transaction broadcast to eligible peers.
Queue the witness transaction id to the inbound and outbound inv backlogs. Later, depending on -txsendrate, Peer::TxRelay::m_next_inv_send_time and if the transaction is in the mempool, an INV about it may be sent to the peer.
|
static |
|
pure virtual |
Send ping message to all peers.
|
pure virtual |
Set the height of the best block and its time (seconds since epoch).
|
pure virtual |
Begin running background tasks, should only be called once.
|
pure virtual |
|
pure virtual |
This function is used for testing the stale tip eviction logic, see denialofservice_tests.cpp.