mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
[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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user