Skip to content

Commit 9eed22e

Browse files
committed
net: attempt v2 transport for addrfetch connections if we support it
1 parent 770c031 commit 9eed22e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/net.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2322,10 +2322,13 @@ void CConnman::ProcessAddrFetch()
23222322
strDest = m_addr_fetches.front();
23232323
m_addr_fetches.pop_front();
23242324
}
2325+
// Attempt v2 connection if we support v2 - we'll reconnect with v1 if our
2326+
// peer doesn't support it or immediately disconnects us for another reason.
2327+
const bool use_v2transport(GetLocalServices() & NODE_P2P_V2);
23252328
CAddress addr;
23262329
CSemaphoreGrant grant(*semOutbound, /*fTry=*/true);
23272330
if (grant) {
2328-
OpenNetworkConnection(addr, false, std::move(grant), strDest.c_str(), ConnectionType::ADDR_FETCH, /*use_v2transport=*/false);
2331+
OpenNetworkConnection(addr, false, std::move(grant), strDest.c_str(), ConnectionType::ADDR_FETCH, use_v2transport);
23292332
}
23302333
}
23312334

0 commit comments

Comments
 (0)