Previously, when debug=net is enabled, we log “New [..] peer connected” for new inbound peers with LogPrintf. However, LogPrintf will get rate-limited since #32604. When we specifically turn on debug=net, we don’t want these log messages to be rate-limited.
To fix this, use LogDebug if debug=net is enabled. Otherwise use LogPrintf. This means we don’t rate-limit the message with debug=net (due to LogDebug not being rate-limited) but still rate-limit it without debug=net with using LogPrintf.
–
I ran into this message getting rate-limited on one of my monitoring nodes with -logsourcelocations=1: With logsourcelocations, one of these lines is about 338 chars (or 338 bytes) long. We rate-limit after more than 1048576 bytes per hour, which results in about 3100 in- and outbound connections per hour. With evicted and instantly reconnecting connections from an entity like LinkingLion, this can be reached fairly quickly.