mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
[net_processing] Change PeerLogicValidation to hold a connman reference
Hold a reference to connman rather than a pointer because: - PeerLogicValidation can't run without a connman - The pointer never gets reseated The alternative is to always assert that the pointer is non-null before dereferencing. Change the name from connman to m_connman at the same time to conform with current style guidelines.
This commit is contained in:
@@ -28,7 +28,7 @@ static const int DISCOURAGEMENT_THRESHOLD{100};
|
||||
|
||||
class PeerLogicValidation final : public CValidationInterface, public NetEventsInterface {
|
||||
private:
|
||||
CConnman* const connman;
|
||||
CConnman& m_connman;
|
||||
/** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */
|
||||
BanMan* const m_banman;
|
||||
ChainstateManager& m_chainman;
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
bool MaybeDiscourageAndDisconnect(CNode& pnode);
|
||||
|
||||
public:
|
||||
PeerLogicValidation(CConnman* connman, BanMan* banman, CScheduler& scheduler, ChainstateManager& chainman, CTxMemPool& pool);
|
||||
PeerLogicValidation(CConnman& connman, BanMan* banman, CScheduler& scheduler, ChainstateManager& chainman, CTxMemPool& pool);
|
||||
|
||||
/**
|
||||
* Overridden from CValidationInterface.
|
||||
|
||||
Reference in New Issue
Block a user