aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2018-03-05 14:31:13 -0500
committerJames O'Beirne <james.obeirne@gmail.com>2018-03-06 14:43:32 -0500
commitb7cd08b717b57376d23ea550da60b00f239556db (patch)
tree82106d1e04659d79206a98403c75afadf75a0ab7 /src/net_processing.h
parent480f42630cbd598c04fa59ee0e406f56904ecffb (diff)
downloadbitcoin-b7cd08b717b57376d23ea550da60b00f239556db.tar.xz
Add documentation to PeerLogicValidation interface and related functions
Diffstat (limited to 'src/net_processing.h')
-rw-r--r--src/net_processing.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/net_processing.h b/src/net_processing.h
index b534ef01c3..ff1ebc59da 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -42,13 +42,26 @@ private:
public:
explicit PeerLogicValidation(CConnman* connman, CScheduler &scheduler);
+ /**
+ * Overridden from CValidationInterface.
+ */
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected, const std::vector<CTransactionRef>& vtxConflicted) override;
+ /**
+ * Overridden from CValidationInterface.
+ */
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
+ /**
+ * Overridden from CValidationInterface.
+ */
void BlockChecked(const CBlock& block, const CValidationState& state) override;
+ /**
+ * Overridden from CValidationInterface.
+ */
void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock) override;
-
+ /** Initialize a peer by adding it to mapNodeState and pushing a message requesting its version */
void InitializeNode(CNode* pnode) override;
+ /** Handle removal of a peer by updating various state and removing it from mapNodeState */
void FinalizeNode(NodeId nodeid, bool& fUpdateConnectionTime) override;
/** Process protocol messages received from a given node */
bool ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt) override;
@@ -61,8 +74,11 @@ public:
*/
bool SendMessages(CNode* pto, std::atomic<bool>& interrupt) override;
+ /** 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);
+ /** Evict extra outbound peers. If we think our tip may be stale, connect to an extra outbound */
void CheckForStaleTipAndEvictPeers(const Consensus::Params &consensusParams);
+ /** If we have extra outbound peers, try to disconnect the one with the oldest block announcement */
void EvictExtraOutboundPeers(int64_t time_in_seconds);
private: