Skip to content

Commit

Permalink
net: attempt v2 transport for addrfetch connections if we support it
Browse files Browse the repository at this point in the history
  • Loading branch information
mzumsande committed Dec 27, 2023
1 parent 770c031 commit 9eed22e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,10 +2322,13 @@ void CConnman::ProcessAddrFetch()
strDest = m_addr_fetches.front();
m_addr_fetches.pop_front();
}
// Attempt v2 connection if we support v2 - we'll reconnect with v1 if our
// peer doesn't support it or immediately disconnects us for another reason.
const bool use_v2transport(GetLocalServices() & NODE_P2P_V2);
CAddress addr;
CSemaphoreGrant grant(*semOutbound, /*fTry=*/true);
if (grant) {
OpenNetworkConnection(addr, false, std::move(grant), strDest.c_str(), ConnectionType::ADDR_FETCH, /*use_v2transport=*/false);
OpenNetworkConnection(addr, false, std::move(grant), strDest.c_str(), ConnectionType::ADDR_FETCH, use_v2transport);
}
}

Expand Down

0 comments on commit 9eed22e

Please sign in to comment.