aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.h
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-08-12 11:48:28 +0100
committerJohn Newbery <john@johnnewbery.com>2020-09-07 11:13:58 +0100
commit2297b26b3ce95e935c0ebb8c38dabf19965054a5 (patch)
treea82488ad7ea7001443ef6218c2ccead6a756732a /src/net_processing.h
parent824bbd1ffba3df7ffa6f5bfaa31298cd484473b1 (diff)
[net_processing] Pass chainparams to PeerLogicValidation constructor
Keep a references to chainparams, rather than calling the global Params() function every time it's needed. This is fine, since globalChainParams does not get updated once it's been set, and it's available at the point of constructing the PeerLogicValidation object.
Diffstat (limited to 'src/net_processing.h')
-rw-r--r--src/net_processing.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net_processing.h b/src/net_processing.h
index 4ba8d34b68..65fabcca3d 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -29,7 +29,8 @@ static const int DISCOURAGEMENT_THRESHOLD{100};
class PeerLogicValidation final : public CValidationInterface, public NetEventsInterface {
public:
- PeerLogicValidation(CConnman& connman, BanMan* banman, CScheduler& scheduler, ChainstateManager& chainman, CTxMemPool& pool);
+ PeerLogicValidation(const CChainParams& chainparams, CConnman& connman, BanMan* banman,
+ CScheduler& scheduler, ChainstateManager& chainman, CTxMemPool& pool);
/**
* Overridden from CValidationInterface.
@@ -79,8 +80,7 @@ public:
/** 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 CChainParams& chainparams,
- const std::atomic<bool>& interruptMsgProc);
+ const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc);
private:
/** Maybe disconnect a peer and discourage future connections from its address.
@@ -90,6 +90,7 @@ private:
*/
bool MaybeDiscourageAndDisconnect(CNode& pnode);
+ const CChainParams& m_chainparams;
CConnman& m_connman;
/** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */
BanMan* const m_banman;