diff --git a/src/net.h b/src/net.h --- a/src/net.h +++ b/src/net.h @@ -864,8 +864,6 @@ // This boolean is unusued in actual processing, only present for backward // compatibility at RPC/QT level bool m_legacyWhitelisted{false}; - // If true this node is being used as a short lived feeler. - bool fFeeler{false}; bool m_addr_fetch{false}; // set by version message bool fClient{false}; @@ -886,6 +884,8 @@ bool IsManualConn() const { return m_conn_type == ConnectionType::MANUAL; } + bool IsFeelerConn() const { return m_conn_type == ConnectionType::FEELER; } + 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 @@ -1788,10 +1788,11 @@ { LOCK(cs_vNodes); for (const CNode *pnode : vNodes) { - nRelevant += - pnode->fSuccessfullyConnected && - !pnode->fFeeler && !pnode->m_addr_fetch && - !pnode->IsManualConn() && !pnode->fInbound; + nRelevant += pnode->fSuccessfullyConnected && + !pnode->IsFeelerConn() && + !pnode->m_addr_fetch && + !pnode->IsManualConn() && + !pnode->fInbound; } } if (nRelevant >= 2) { @@ -1915,9 +1916,9 @@ { LOCK(cs_vNodes); for (const CNode *pnode : vNodes) { - if (!pnode->fInbound && !pnode->IsManualConn() && !pnode->fFeeler && - !pnode->fDisconnect && !pnode->m_addr_fetch && - pnode->fSuccessfullyConnected) { + if (!pnode->fInbound && !pnode->IsManualConn() && + !pnode->IsFeelerConn() && !pnode->fDisconnect && + !pnode->m_addr_fetch && pnode->fSuccessfullyConnected) { ++nOutbound; } } @@ -2007,7 +2008,7 @@ setConnected.insert(pnode->addr.GetGroup(addrman.m_asmap)); if (pnode->m_tx_relay == nullptr) { nOutboundBlockRelay++; - } else if (!pnode->fFeeler) { + } else if (!pnode->IsFeelerConn()) { nOutboundFullRelay++; } } @@ -2988,7 +2989,7 @@ const CAddress &addrBindIn, const std::string &addrNameIn, ConnectionType conn_type_in) : nTimeConnected(GetSystemTimeInSeconds()), addr(addrIn), - addrBind(addrBindIn), fFeeler(conn_type_in == ConnectionType::FEELER), + addrBind(addrBindIn), m_addr_fetch(conn_type_in == ConnectionType::ADDR_FETCH), fInbound(conn_type_in == ConnectionType::INBOUND), nKeyedNetGroup(nKeyedNetGroupIn), diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -935,7 +935,7 @@ } static bool IsOutboundDisconnectionCandidate(const CNode &node) { - return !(node.fInbound || node.IsManualConn() || node.fFeeler || + return !(node.fInbound || node.IsManualConn() || node.IsFeelerConn() || node.m_addr_fetch); } @@ -2537,7 +2537,7 @@ if (!pfrom.fInbound) { connman.SetServices(pfrom.addr, nServices); } - if (!pfrom.fInbound && !pfrom.fFeeler && !pfrom.IsManualConn() && + if (!pfrom.fInbound && !pfrom.IsFeelerConn() && !pfrom.IsManualConn() && !HasAllDesirableServiceFlags(nServices)) { LogPrint(BCLog::NET, "peer=%d does not offer the expected services " @@ -2678,8 +2678,7 @@ } // Feeler connections exist only to verify if address is online. - if (pfrom.fFeeler) { - assert(pfrom.fInbound == false); + if (pfrom.IsFeelerConn()) { pfrom.fDisconnect = true; } return true; diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -185,18 +185,15 @@ CAddress addr = CAddress(CService(ipv4Addr, 7777), NODE_NETWORK); std::string pszDest; - // Test that fFeeler is false by default. auto pnode1 = std::make_unique(id++, NODE_NETWORK, height, hSocket, addr, 0, 0, CAddress(), pszDest, ConnectionType::OUTBOUND); BOOST_CHECK(pnode1->fInbound == false); - BOOST_CHECK(pnode1->fFeeler == false); auto pnode2 = std::make_unique(id++, NODE_NETWORK, height, hSocket, addr, 1, 1, CAddress(), pszDest, ConnectionType::INBOUND); BOOST_CHECK(pnode2->fInbound == true); - BOOST_CHECK(pnode2->fFeeler == false); } BOOST_AUTO_TEST_CASE(test_getSubVersionEB) {