diff --git a/src/net.h b/src/net.h --- a/src/net.h +++ b/src/net.h @@ -864,7 +864,6 @@ // This boolean is unusued in actual processing, only present for backward // compatibility at RPC/QT level bool m_legacyWhitelisted{false}; - bool m_addr_fetch{false}; // set by version message bool fClient{false}; // after BIP159, set by version message @@ -886,6 +885,10 @@ bool IsFeelerConn() const { return m_conn_type == ConnectionType::FEELER; } + bool IsAddrFetchConn() const { + return m_conn_type == ConnectionType::ADDR_FETCH; + } + protected: mapMsgCmdSize mapSendBytesPerMsgCmd; mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv); diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -1790,7 +1790,7 @@ for (const CNode *pnode : vNodes) { nRelevant += pnode->fSuccessfullyConnected && !pnode->IsFeelerConn() && - !pnode->m_addr_fetch && + !pnode->IsAddrFetchConn() && !pnode->IsManualConn() && !pnode->fInbound; } @@ -1918,7 +1918,7 @@ for (const CNode *pnode : vNodes) { if (!pnode->fInbound && !pnode->IsManualConn() && !pnode->IsFeelerConn() && !pnode->fDisconnect && - !pnode->m_addr_fetch && pnode->fSuccessfullyConnected) { + !pnode->IsAddrFetchConn() && pnode->fSuccessfullyConnected) { ++nOutbound; } } @@ -2989,9 +2989,7 @@ const CAddress &addrBindIn, const std::string &addrNameIn, ConnectionType conn_type_in) : nTimeConnected(GetSystemTimeInSeconds()), addr(addrIn), - addrBind(addrBindIn), - m_addr_fetch(conn_type_in == ConnectionType::ADDR_FETCH), - fInbound(conn_type_in == ConnectionType::INBOUND), + addrBind(addrBindIn), fInbound(conn_type_in == ConnectionType::INBOUND), nKeyedNetGroup(nKeyedNetGroupIn), // Don't relay addr messages to peers that we connect to as // block-relay-only peers (to prevent adversaries from inferring these diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -488,7 +488,7 @@ // Whether this node should be marked as a preferred download node. state->fPreferredDownload = (!node.fInbound || node.HasPermission(PF_NOBAN)) && - !node.m_addr_fetch && !node.fClient; + !node.IsAddrFetchConn() && !node.fClient; nPreferredDownload += state->fPreferredDownload; } @@ -936,7 +936,7 @@ static bool IsOutboundDisconnectionCandidate(const CNode &node) { return !(node.fInbound || node.IsManualConn() || node.IsFeelerConn() || - node.m_addr_fetch); + node.IsAddrFetchConn()); } void PeerLogicValidation::InitializeNode(const Config &config, CNode *pnode) { @@ -2798,7 +2798,7 @@ if (vAddr.size() < 1000) { pfrom.fGetAddr = false; } - if (pfrom.m_addr_fetch) { + if (pfrom.IsAddrFetchConn()) { pfrom.fDisconnect = true; } return true; @@ -4673,7 +4673,7 @@ // might do. bool fFetch = state.fPreferredDownload || - (nPreferredDownload == 0 && !pto->fClient && !pto->m_addr_fetch); + (nPreferredDownload == 0 && !pto->fClient && !pto->IsAddrFetchConn()); if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) { // Only actively request headers from a single peer, unless we're close