From 824bbd1ffba3df7ffa6f5bfaa31298cd484473b1 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 24 Aug 2020 15:37:13 +0100 Subject: [move only] Collect all private members of PeerLogicValidation together We don't have a project style for ordering class members, but it always makes sense to have no more than one of each public/protected/private specifier. Also move documentation for MaybeDiscourageAndDisconnect to the header. --- src/net_processing.cpp | 5 ----- src/net_processing.h | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 15508683ce..6608aa9904 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3795,11 +3795,6 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty return; } -/** Maybe disconnect a peer and discourage future connections from its address. - * - * @param[in] pnode The node to check. - * @return True if the peer was marked for disconnection in this function - */ bool PeerLogicValidation::MaybeDiscourageAndDisconnect(CNode& pnode) { const NodeId peer_id{pnode.GetId()}; diff --git a/src/net_processing.h b/src/net_processing.h index 4f1c52fc17..4ba8d34b68 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -28,15 +28,6 @@ static const bool DEFAULT_PEERBLOCKFILTERS = false; static const int DISCOURAGEMENT_THRESHOLD{100}; class PeerLogicValidation final : public CValidationInterface, public NetEventsInterface { -private: - CConnman& m_connman; - /** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */ - BanMan* const m_banman; - ChainstateManager& m_chainman; - CTxMemPool& m_mempool; - - bool MaybeDiscourageAndDisconnect(CNode& pnode); - public: PeerLogicValidation(CConnman& connman, BanMan* banman, CScheduler& scheduler, ChainstateManager& chainman, CTxMemPool& pool); @@ -92,8 +83,20 @@ public: const std::atomic& interruptMsgProc); private: - int64_t m_stale_tip_check_time; //!< Next time to check for stale tip + /** Maybe disconnect a peer and discourage future connections from its address. + * + * @param[in] pnode The node to check. + * @return True if the peer was marked for disconnection in this function + */ + bool MaybeDiscourageAndDisconnect(CNode& pnode); + CConnman& m_connman; + /** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */ + BanMan* const m_banman; + ChainstateManager& m_chainman; + CTxMemPool& m_mempool; + + int64_t m_stale_tip_check_time; //!< Next time to check for stale tip }; struct CNodeStateStats { -- cgit v1.2.3