[net/net processing] check banman pointer before dereferencing

Although we currently don't do this, it should be possible to create a
CConnman or PeerLogicValidation without a Banman instance. Therefore
always check that banman exists before dereferencing the pointer.

Also add comments to the m_banman members of CConnman and
PeerLogicValidation to document that these may be nullptr.
This commit is contained in:
John Newbery
2020-07-14 10:24:43 +01:00
parent 07c83ce039
commit ca3585a483
4 changed files with 10 additions and 5 deletions

View File

@@ -447,6 +447,7 @@ private:
std::atomic<int> nBestHeight;
CClientUIInterface* clientInterface;
NetEventsInterface* m_msgproc;
/** Pointer to this node's banman. May be nullptr - check existence before dereferencing. */
BanMan* m_banman;
/** SipHasher seeds for deterministic randomness */