From a49f97ff4a3f20bb4e73e625de1522d21752fe25 Mon Sep 17 00:00:00 2001 From: sedited Date: Thu, 29 Jan 2026 12:12:25 +0100 Subject: [PATCH] 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. --- src/net.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 16591461efb..ec4944c85f6 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -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()); + } } }