diff options
author | John Newbery <john@johnnewbery.com> | 2020-08-12 11:38:56 +0100 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2020-08-12 14:25:28 +0100 |
commit | c556770b5ef4306f10e980daff772bee87daaa30 (patch) | |
tree | 3f75227574331890f74d8e5e20e38e348c9d1896 /src/net_processing.h | |
parent | bd00d3b1f2036893419d1e8c514a8af2c4e4b1fb (diff) |
[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.
Diffstat (limited to 'src/net_processing.h')
-rw-r--r-- | src/net_processing.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net_processing.h b/src/net_processing.h index 2d98714122..7ef0484278 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -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. |