net: Don't log own ips during discover

The -logips option seems to imply that ip addresses are only logged when
it is set. This seems like an obvious case for not logging these by
default.
This commit is contained in:
sedited
2026-01-29 12:12:25 +01:00
parent 1c2f164d34
commit a49f97ff4a

View File

@@ -287,7 +287,9 @@ bool AddLocal(const CService& addr_, int nScore)
if (!g_reachable_nets.Contains(addr))
return false;
LogInfo("AddLocal(%s,%i)\n", addr.ToStringAddrPort(), nScore);
if (fLogIPs) {
LogInfo("AddLocal(%s,%i)\n", addr.ToStringAddrPort(), nScore);
}
{
LOCK(g_maplocalhost_mutex);
@@ -310,7 +312,10 @@ bool AddLocal(const CNetAddr &addr, int nScore)
void RemoveLocal(const CService& addr)
{
LOCK(g_maplocalhost_mutex);
LogInfo("RemoveLocal(%s)\n", addr.ToStringAddrPort());
if (fLogIPs) {
LogInfo("RemoveLocal(%s)\n", addr.ToStringAddrPort());
}
mapLocalHost.erase(addr);
}
@@ -3345,8 +3350,9 @@ void Discover()
return;
for (const CNetAddr &addr: GetLocalAddresses()) {
if (AddLocal(addr, LOCAL_IF))
if (AddLocal(addr, LOCAL_IF) && fLogIPs) {
LogInfo("%s: %s\n", __func__, addr.ToStringAddr());
}
}
}