Skip to content

Commit

Permalink
[move only] Collect all private members of PeerLogicValidation together
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jnewbery committed Sep 7, 2020
1 parent 0708705 commit 824bbd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
5 changes: 0 additions & 5 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
Expand Down
23 changes: 13 additions & 10 deletions src/net_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -92,8 +83,20 @@ class PeerLogicValidation final : public CValidationInterface, public NetEventsI
const std::atomic<bool>& 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 {
Expand Down

0 comments on commit 824bbd1

Please sign in to comment.