aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.h
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2020-12-23 17:14:08 +1000
committerAnthony Towns <aj@erisian.com.au>2021-01-09 23:27:45 +1000
commit0df3d3fd6bbbd0e06116797177ba797580553250 (patch)
treeb5cf0e8df62688cd214b44cd71294cb1f8aa05ea /src/net_processing.h
parent0d246a59b606c51728d10cb70004a6eedb951bca (diff)
downloadbitcoin-0df3d3fd6bbbd0e06116797177ba797580553250.tar.xz
net_processing: make more of PeerManager private
Diffstat (limited to 'src/net_processing.h')
-rw-r--r--src/net_processing.h56
1 files changed, 26 insertions, 30 deletions
diff --git a/src/net_processing.h b/src/net_processing.h
index 076dce1713..28d0c34d78 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -100,41 +100,27 @@ public:
CScheduler& scheduler, ChainstateManager& chainman, CTxMemPool& pool,
bool ignore_incoming_txs);
- /**
- * Overridden from CValidationInterface.
- */
+ /** Overridden from CValidationInterface. */
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected) override;
void BlockDisconnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex) override;
- /**
- * Overridden from CValidationInterface.
- */
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
- /**
- * Overridden from CValidationInterface.
- */
void BlockChecked(const CBlock& block, const BlockValidationState& state) override;
- /**
- * Overridden from CValidationInterface.
- */
void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock) override;
+ /** Implement NetEventsInterface */
void InitializeNode(CNode* pnode) override;
void FinalizeNode(const CNode& node, bool& fUpdateConnectionTime) override;
bool ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt) override;
bool SendMessages(CNode* pto) override EXCLUSIVE_LOCKS_REQUIRED(pto->cs_sendProcessing);
- /** Consider evicting an outbound peer based on the amount of time they've been behind our tip */
- void ConsiderEviction(CNode& pto, int64_t time_in_seconds) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
- /** Evict extra outbound peers. If we think our tip may be stale, connect to an extra outbound */
- void CheckForStaleTipAndEvictPeers();
- /** If we have extra outbound peers, try to disconnect the one with the oldest block announcement */
- void EvictExtraOutboundPeers(int64_t time_in_seconds) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
- /** Retrieve unbroadcast transactions from the mempool and reattempt sending to peers */
- void ReattemptInitialBroadcast(CScheduler& scheduler) const;
+ /** Get statistics from node state */
+ bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats);
- /** Process a single message from a peer. Public for fuzz testing */
- void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv,
- const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc);
+ /** Whether this node ignores txs received over p2p. */
+ bool IgnoresIncomingTxs() { return m_ignore_incoming_txs; };
+
+ /** Set the best height */
+ void SetBestHeight(int height) { m_best_height = height; };
/**
* Increment peer's misbehavior score. If the new value >= DISCOURAGEMENT_THRESHOLD, mark the node
@@ -143,16 +129,26 @@ public:
*/
void Misbehaving(const NodeId pnode, const int howmuch, const std::string& message);
- /** Get statistics from node state */
- bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats);
-
- /** Set the best height */
- void SetBestHeight(int height) { m_best_height = height; };
+ /**
+ * Evict extra outbound peers. If we think our tip may be stale, connect to an extra outbound.
+ * Public for unit testing.
+ */
+ void CheckForStaleTipAndEvictPeers();
- /** Whether this node ignores txs received over p2p. */
- bool IgnoresIncomingTxs() { return m_ignore_incoming_txs; };
+ /** Process a single message from a peer. Public for fuzz testing */
+ void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv,
+ const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc);
private:
+ /** Consider evicting an outbound peer based on the amount of time they've been behind our tip */
+ void ConsiderEviction(CNode& pto, int64_t time_in_seconds) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
+
+ /** If we have extra outbound peers, try to disconnect the one with the oldest block announcement */
+ void EvictExtraOutboundPeers(int64_t time_in_seconds) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
+
+ /** Retrieve unbroadcast transactions from the mempool and reattempt sending to peers */
+ void ReattemptInitialBroadcast(CScheduler& scheduler) const;
+
/** Get a shared pointer to the Peer object.
* May return an empty shared_ptr if the Peer object can't be found. */
PeerRef GetPeerRef(NodeId id) const;