net, refactor: pass reference for peer address in GetReachabilityFrom

The address of the peer always exists (because addr is a member of
CNode), so it was not possible to pass a nullptr before.
Also remove NET_UNKNOWN, which is unused now.
This commit is contained in:
Martin Zumsande
2023-04-11 16:10:28 -04:00
parent 62d73f5370
commit e4d541c7cf
4 changed files with 9 additions and 13 deletions

View File

@@ -165,7 +165,7 @@ bool GetLocal(CService& addr, const CNode& peer)
for (const auto& entry : mapLocalHost)
{
int nScore = entry.second.nScore;
int nReachability = entry.first.GetReachabilityFrom(&peer.addr);
int nReachability = entry.first.GetReachabilityFrom(peer.addr);
if (nReachability > nBestReachability || (nReachability == nBestReachability && nScore > nBestScore))
{
addr = CService(entry.first, entry.second.nPort);