log: don’t rate-limit “new peer” with -debug=net #34008

pull 0xB10C wants to merge 1 commits into bitcoin:master from 0xB10C:2025-12-dont-ratelimit-new-inbound-peer-connected-with-debug=net changing 1 files +14 −8
  1. 0xB10C commented at 5:51 pm on December 4, 2025: contributor

    Previously, when debug=net is enabled, we log “New [..] peer connected” for new inbound peers with LogInfo. However, LogInfo 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(BCLog::NET, ...) for potentially high-rate inbound connections. Otherwise use LogInfo. This means we don’t rate-limit the messages for inbound peers when debug=net is turned on but will rate-limit if we created outbound at a high rate as these are logged via LogInfo.

    The new log messages look similar to:

    02025-12-08T00:00:00Z [net] New inbound peer connected: transport=v2 version=70016 blocks=0 peer=1
    12025-12-08T00:00:00Z New outbound-full-relay peer connected: transport=v2 version=70016 blocks=281738 peer=5
    

    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.

  2. DrahtBot added the label Utils/log/libs on Dec 4, 2025
  3. DrahtBot commented at 5:51 pm on December 4, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34008.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK stickies-v, Crypt-iQ, maflcko, rkrux, glozow
    Stale ACK dergoegge

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

    Conflicts

    No conflicts as of last run.

  4. in src/net_processing.cpp:3668 in 57eef67c53
    3670-                      TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    3671-                      pfrom.nVersion.load(), peer->m_starting_height,
    3672-                      pfrom.GetId(), pfrom.LogIP(fLogIPs),
    3673-                      (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    3674+            // With "net" debug logging enabled, log this with LogDebug to not trigger rate-limiting.
    3675+            // Keep the two log messages in sync!
    


    0xB10C commented at 5:51 pm on December 4, 2025:

    I’m not super happy with this approach of duplicating the log statement, but I think it’s the clearest to a reader. If someone feels strongly, I’m very happy to change it to something better! There are two alternatives that came to mind:

    1. Use a macro to avoid duplicating the log statements: Not sure if we want to define a macro extra for this, but could be done. This was my initial approach I dismissed.
    2. Extract the log message string and format it with e.g. std::format() first, then pass it to either one of the two log macros. This would mean this log message is the only one not formatted with tinyformat..
  5. in src/net_processing.cpp:3683 in 57eef67c53
    3685+                        pfrom.ConnectionTypeAsString(),
    3686+                        TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    3687+                        pfrom.nVersion.load(), peer->m_starting_height,
    3688+                        pfrom.GetId(), pfrom.LogIP(fLogIPs),
    3689+                        (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    3690+            }
    


    ajtowns commented at 6:06 pm on December 4, 2025:

    Perhaps

    0auto mapped_as_info = [&]() -> std::string {
    1    const auto mapped_as{m_connman.GetMappedAS(pfrom.addr);
    2    return (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : "");
    3};
    4if (!pfrom.IsInboundconn()) {
    5    LogInfo("New %s %s peer ...", ..., mapped_as_info());
    6} else {
    7    LogDebug(BCLog::NET, "New %s %s ...", ..., mapped_as_info());
    8}
    

    ajtowns commented at 6:08 pm on December 4, 2025:
    Or could make it auto conn_details = [&]() ... and LogDebug(BCLog::NET, "New %s peer connected: %s", pfrom.ConnectionTypeAsString(), conn_details()) and move all the transport, version, mapped_as stuff into the lambda, moving the transport type to after the colon.

    0xB10C commented at 7:15 pm on December 4, 2025:

    Or could make it auto conn_details = [&]() ... and LogDebug(BCLog::NET, "New %s peer connected: %s", pfrom.ConnectionTypeAsString(), conn_details()) and move all the transport, version, mapped_as stuff into the lambda, moving the transport type to after the colon.

    Could do

    0const std::string details = std::format(
    1    "transport={} version={} blocks={} peer={}{}{}",
    2    TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    3    pfrom.nVersion.load(),
    4    int{peer->m_starting_height},
    5    pfrom.GetId(),
    6    (fLogIPs ? std::format(", addr={}", pfrom.LogIP(fLogIPs)) : ""),
    7    (mapped_as ? std::format(", mapped_as={}", mapped_as) : "")
    8);
    

    0xB10C commented at 7:21 pm on December 4, 2025:
    I guess the lambda helps to not create the details string if we don’t end up logging it.

    ajtowns commented at 1:07 pm on December 7, 2025:

    Yeah. If it’s not obvious, the whole thing would look something like:

     0        auto new_peer_info = [&]() {
     1            // lambda so that this info is only calculated if needed
     2            const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
     3            return strprintf("transport: %s version: %d, blocks=%d, peer=%d%s%s\n",
     4                        TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
     5                        pfrom.nVersion.load(), peer->m_starting_height,
     6                        pfrom.GetId(), pfrom.LogIP(fLogIPs),
     7                        (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
     8        };
     9
    10        if (!pfrom.IsInboundConn()) {
    11            // Log successful connections unconditionally for outbound...
    12            LogInfo("New %s peer connected: %s",
    13                    pfrom.ConnectionTypeAsString(), new_peer_info());
    14        } else {
    15            // ... but not for inbound as those can be triggered by an attacker at high rate.
    16            LogDebug(BCLog::NET, "New %s peer connected: %s",
    17                     pfrom.ConnectionTypeAsString(), new_peer_info());
    18        }
    
  6. fanquake commented at 7:12 pm on December 4, 2025: member
  7. stickies-v commented at 7:49 pm on December 4, 2025: contributor

    Concept ACK

    Another approach could be to exempt all (not just debug) logs from a debug-enabled category? I think conceptually that makes sense, and I suspect there will be more places where this is helpful so we can minimize the workarounds needed?

    For example:

     0diff --git a/src/logging.h b/src/logging.h
     1index defff61d30..074096ed5f 100644
     2--- a/src/logging.h
     3+++ b/src/logging.h
     4@@ -377,16 +377,18 @@ inline void LogPrintFormatInternal(std::source_location&& source_loc, BCLog::Log
     5 
     6 // Log by prefixing the output with the passed category name and severity level. This can either
     7 // log conditionally if the category is allowed or unconditionally if level >= BCLog::Level::Info
     8-// is passed. If this function logs unconditionally, logging to disk is rate-limited. This is
     9-// important so that callers don't need to worry about accidentally introducing a disk-fill
    10-// vulnerability if level >= Info is used. Additionally, users specifying -debug are assumed to be
    11-// developers or power users who are aware that -debug may cause excessive disk usage due to logging.
    12-#define LogPrintLevel(category, level, ...)                           \
    13-    do {                                                              \
    14-        if (LogAcceptCategory((category), (level))) {                 \
    15-            bool rate_limit{level >= BCLog::Level::Info};             \
    16-            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__); \
    17-        }                                                             \
    18+// is passed. If this function logs unconditionally, logging to disk is rate-limited unless debug
    19+// logging is enabled for that category. This is important so that callers don't need to worry
    20+// about accidentally introducing a disk-fill vulnerability if level >= Info is used.
    21+// Users specifying -debug are assumed to be developers or power users who are aware that this may
    22+// cause excessive disk usage due to logging, so rate limiting is disabled for those categories.
    23+#define LogPrintLevel(category, level, ...)                                                  \
    24+    do {                                                                                     \
    25+        if (LogAcceptCategory((category), (level))) {                                        \
    26+            bool debug_category_enabled{LogAcceptCategory((category), BCLog::Level::Debug)}; \
    27+            bool rate_limit{level >= BCLog::Level::Info && !debug_category_enabled};         \
    28+            LogPrintLevel_(category, level, rate_limit, __VA_ARGS__);                        \
    29+        }                                                                                    \
    30     } while (0)
    31 
    32 // Log conditionally, prefixing the output with the passed category name.
    33diff --git a/src/net_processing.cpp b/src/net_processing.cpp
    34index 9cab246176..eff85190f2 100644
    35--- a/src/net_processing.cpp
    36+++ b/src/net_processing.cpp
    37@@ -3663,12 +3663,13 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
    38         // can be triggered by an attacker at high rate.
    39         if (!pfrom.IsInboundConn() || LogAcceptCategory(BCLog::NET, BCLog::Level::Debug)) {
    40             const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
    41-            LogPrintf("New %s %s peer connected: version: %d, blocks=%d, peer=%d%s%s\n",
    42-                      pfrom.ConnectionTypeAsString(),
    43-                      TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    44-                      pfrom.nVersion.load(), peer->m_starting_height,
    45-                      pfrom.GetId(), pfrom.LogIP(fLogIPs),
    46-                      (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    47+            LogPrintLevel(BCLog::NET, BCLog::Level::Info,
    48+                          "New %s %s peer connected: version: %d, blocks=%d, peer=%d%s%s\n",
    49+                          pfrom.ConnectionTypeAsString(),
    50+                          TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    51+                          pfrom.nVersion.load(), peer->m_starting_height,
    52+                          pfrom.GetId(), pfrom.LogIP(fLogIPs),
    53+                          (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    54         }
    55 
    56         if (pfrom.GetCommonVersion() >= SHORT_IDS_BLOCKS_VERSION) {
    57diff --git a/src/test/logging_tests.cpp b/src/test/logging_tests.cpp
    58index 3cf261a429..24884fa7c2 100644
    59--- a/src/test/logging_tests.cpp
    60+++ b/src/test/logging_tests.cpp
    61@@ -389,6 +389,7 @@ enum class Location {
    62     INFO_2,
    63     DEBUG_LOG,
    64     INFO_NOLIMIT,
    65+    INFO_CATEGORY,
    66 };
    67 
    68 void LogFromLocation(Location location, const std::string& message) {
    69@@ -405,6 +406,9 @@ void LogFromLocation(Location location, const std::string& message) {
    70     case Location::INFO_NOLIMIT:
    71         LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Info, /*should_ratelimit=*/false, "%s\n", message);
    72         return;
    73+    case Location::INFO_CATEGORY:
    74+        LogPrintLevel(BCLog::LogFlags::HTTP, BCLog::Level::Info, "%s\n", message);
    75+        return;
    76     } // no default case, so the compiler can warn about missing cases
    77     assert(false);
    78 }
    79@@ -482,6 +486,16 @@ BOOST_FIXTURE_TEST_CASE(logging_filesize_rate_limit, LogSetup)
    80             TestLogFromLocation(location, log_message, Status::UNSUPPRESSED, /*suppressions_active=*/false);
    81         }
    82     }
    83+
    84+    // Check that Info-level logs with a specific category are NOT rate-limited
    85+    // when that category has debug logging enabled.
    86+    limiter = scheduler.GetLimiter(bytes_quota, time_window);
    87+    LogInstance().SetRateLimiting(limiter);
    88+    BOOST_CHECK(!limiter->SuppressionsActive());
    89+
    90+    for (int i = 0; i < num_lines + 2; ++i) {
    91+        TestLogFromLocation(Location::INFO_CATEGORY, log_message, Status::UNSUPPRESSED, /*suppressions_active=*/false);
    92+    }
    93 }
    94 
    95 BOOST_AUTO_TEST_SUITE_END()
    
  8. in src/net_processing.cpp:3677 in 57eef67c53
    3679+                        TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    3680+                        pfrom.nVersion.load(), peer->m_starting_height,
    3681+                        pfrom.GetId(), pfrom.LogIP(fLogIPs),
    3682+                        (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    3683+            } else {
    3684+                LogPrintf("New %s %s peer connected: version: %d, blocks=%d, peer=%d%s%s\n",
    


    rkrux commented at 11:39 am on December 5, 2025:

    It’s documented that LogPrintf is deprecated, prefer to avoid its usage?

    https://github.com/bitcoin/bitcoin/blob/0c9ab0f8f8c85719ff3aa4aefe3198cd2f8d63d1/src/logging.h#L372-L373


    fanquake commented at 12:06 pm on December 5, 2025:
    Yes. It should be removed soon: #29641.

    0xB10C commented at 1:19 pm on December 5, 2025:
    Will change this to LogInfo once I figured out a better approach (or when I rebase on merged #29641).
  9. 0xB10C commented at 1:23 pm on December 5, 2025: contributor

    Another approach could be to exempt all (not just debug) logs from a debug-enabled category? I think conceptually that makes sense, and I suspect there will be more places where this is helpful so we can minimize the workarounds needed?

    That would work too, and is a way cleaner approach than duplicating stuff here. I probably won’t get to picking that up anytime soon though, so if you want to open an alternative to this PR, feel free to do so!


    I’ll mark this as draft until I figure out a good approach. Review time is probably best spent on #29641 right now.

  10. 0xB10C marked this as a draft on Dec 5, 2025
  11. stickies-v commented at 3:54 pm on December 5, 2025: contributor

    I probably won’t get to picking that up anytime soon though, so if you want to open an alternative to this PR, feel free to do so!

    I’ve opened #34018 as an alternative!

  12. DrahtBot added the label Needs rebase on Dec 6, 2025
  13. Ataraxia009 commented at 4:25 am on December 7, 2025: none

    Personally I prefer this approach over #34018 @0xB10C @stickies-v

    The only problem I see with this approach is the code duplication. Which I think you solved right? Using:

    0const std::string details = std::format(
    1    "transport={} version={} blocks={} peer={}{}{}",
    2    TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    3    pfrom.nVersion.load(),
    4    int{peer->m_starting_height},
    5    pfrom.GetId(),
    6    (fLogIPs ? std::format(", addr={}", pfrom.LogIP(fLogIPs)) : ""),
    7    (mapped_as ? std::format(", mapped_as={}", mapped_as) : "")
    8);
    

    Why doesnt this work?

  14. 0xB10C force-pushed on Dec 8, 2025
  15. 0xB10C force-pushed on Dec 8, 2025
  16. DrahtBot added the label CI failed on Dec 8, 2025
  17. DrahtBot commented at 12:04 pm on December 8, 2025: contributor

    🚧 At least one of the CI tasks failed. Task macOS-cross to x86_64: https://github.com/bitcoin/bitcoin/actions/runs/20027106754/job/57426926798 LLM reason (✨ experimental): Build failed due to use of std::format not available in the current compiler/libc++ setup.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  18. 0xB10C commented at 12:49 pm on December 8, 2025: contributor
    • rebased to include #29641. Now using LogInfo instead of LogPrintf. Updated the commit message an PR description accordingly.
    • Switched to AJ’s suggestion from #34008 (review) to only have minimal code duplication. This logs all new outbound connections with LogInfo(), which can potentially get rate-limited, and logs inbound connections with LogDebug(BCLog::NET, ...) which is only active with -debug=net and won’t get rate-limited. Also, a high rate of inbound connections won’t affect logging of outbound connections anymore.

    The new log messages look similar to:

    02025-12-08T00:00:00Z [net] New inbound peer connected: transport=v2 version=70016 blocks=281738 peer=1
    12025-12-08T00:00:00Z New outbound-full-relay peer connected: transport=v2 version=70016 blocks=281738 peer=5
    

    🚧 At least one of the CI tasks failed. Task macOS-cross to x86_64: https://github.com/bitcoin/bitcoin/actions/runs/20027106754/job/57426926798 LLM reason (✨ experimental): Build failed due to use of std::format not available in the current compiler/libc++ setup.

    Not using std::format as that’s not yet supported in our macOS CI. If std::format is wanted as a replacement for strprintf, then that’s probably a project for someone else and out of scope here. Keeping strprintf for now.

    This is ready for review again. Also consider the alternative proposed in #34018.

  19. 0xB10C marked this as ready for review on Dec 8, 2025
  20. DrahtBot removed the label CI failed on Dec 8, 2025
  21. DrahtBot removed the label Needs rebase on Dec 8, 2025
  22. in src/net_processing.cpp:3664 in 8f553ac9df
    3658@@ -3659,16 +3659,23 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
    3659             return;
    3660         }
    3661 
    3662+        auto new_peer_info = [&]() {
    3663+            const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
    3664+            return strprintf("transport: %s, version: %d, blocks=%d peer=%d%s%s\n",
    


    stickies-v commented at 10:09 pm on December 8, 2025:

    clang-format-nit

     0diff --git a/src/net_processing.cpp b/src/net_processing.cpp
     1index a823b2c2e2..802f68e98f 100644
     2--- a/src/net_processing.cpp
     3+++ b/src/net_processing.cpp
     4@@ -3661,11 +3661,12 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
     5 
     6         auto new_peer_info = [&]() {
     7             const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
     8-            return strprintf("transport: %s, version: %d, blocks=%d peer=%d%s%s\n",
     9-                        TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    10-                        pfrom.nVersion.load(), peer->m_starting_height,
    11-                        pfrom.GetId(), pfrom.LogIP(fLogIPs),
    12-                        (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    13+            return strprintf(
    14+                "transport: %s, version: %d, blocks=%d peer=%d%s%s\n",
    15+                TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    16+                pfrom.nVersion.load(), peer->m_starting_height,
    17+                pfrom.GetId(), pfrom.LogIP(fLogIPs),
    18+                (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    19         };
    20 
    21         // Log successful connections unconditionally for outbound, but not for inbound as those
    

    0xB10C commented at 12:06 pm on December 9, 2025:
    ah thanks, done in d4d184eda9c0f73bc31ece07d5001d887b5c6914
  23. in src/net_processing.cpp:3674 in 8f553ac9df
    3677-                      TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    3678-                      pfrom.nVersion.load(), peer->m_starting_height,
    3679-                      pfrom.GetId(), pfrom.LogIP(fLogIPs),
    3680-                      (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    3681+        if (!pfrom.IsInboundConn()) {
    3682+            LogInfo("New %s peer connected: %s",
    


    stickies-v commented at 10:54 pm on December 8, 2025:

    Is there a reason why the message is split across the log statement and the new_peer_info lambda? That feels a bit clunky to me?

     0diff --git a/src/net_processing.cpp b/src/net_processing.cpp
     1index a823b2c2e2..54528ff3d0 100644
     2--- a/src/net_processing.cpp
     3+++ b/src/net_processing.cpp
     4@@ -3659,23 +3659,23 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
     5             return;
     6         }
     7 
     8-        auto new_peer_info = [&]() {
     9+        auto new_peer_msg = [&]() {
    10             const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
    11-            return strprintf("transport: %s, version: %d, blocks=%d peer=%d%s%s\n",
    12-                        TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    13-                        pfrom.nVersion.load(), peer->m_starting_height,
    14-                        pfrom.GetId(), pfrom.LogIP(fLogIPs),
    15-                        (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    16+            return strprintf(
    17+                "New %s peer connected: transport: %s, version: %d, blocks=%d peer=%d%s%s\n",
    18+                pfrom.ConnectionTypeAsString(),
    19+                TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
    20+                pfrom.nVersion.load(), peer->m_starting_height,
    21+                pfrom.GetId(), pfrom.LogIP(fLogIPs),
    22+                (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
    23         };
    24 
    25         // Log successful connections unconditionally for outbound, but not for inbound as those
    26         // can be triggered by an attacker at high rate.
    27         if (!pfrom.IsInboundConn()) {
    28-            LogInfo("New %s peer connected: %s",
    29-                    pfrom.ConnectionTypeAsString(), new_peer_info());
    30+            LogInfo("%s", new_peer_msg());
    31         } else {
    32-            LogDebug(BCLog::NET, "New %s peer connected: %s",
    33-                     pfrom.ConnectionTypeAsString(), new_peer_info());
    34+            LogDebug(BCLog::NET, "%s", new_peer_msg());
    35         }
    36 
    37         if (pfrom.GetCommonVersion() >= SHORT_IDS_BLOCKS_VERSION) {
    

    maflcko commented at 8:45 am on December 9, 2025:
    The if-else has both branches, so the inversion (!) could also be dropped and the branches re-ordered

    0xB10C commented at 12:06 pm on December 9, 2025:
    done both in d4d184eda9c0f73bc31ece07d5001d887b5c6914
  24. stickies-v approved
  25. stickies-v commented at 10:57 pm on December 8, 2025: contributor

    ACK 8f553ac9df91c03a6e753cce3e7cf2e46b977bdb

    Wholesale downgrading inbound connections to LogDebug seems sensible to me. Even with ratelimiting, we should still make sure that unconditional logs can’t easily be triggered by an attacker. (edit: inbound logs were already only printed with debug on, even if they were printed at info level)

    I think this would benefit from a brief release note. People might be confused why they’re no longer seeing inbound connections in their logs?

  26. maflcko commented at 8:44 am on December 9, 2025: member

    I think this would benefit from a brief release note. People might be confused why they’re no longer seeing inbound connections in their logs?

    I don’t think there is a behavior change here. Previously, inbound would only be logged in when net-debug logging, now, it is the same. The only behavior change is the added [net] in [net] New inbound peer ..., no?

  27. dergoegge approved
  28. dergoegge commented at 11:15 am on December 9, 2025: member
    utACK 8f553ac9df91c03a6e753cce3e7cf2e46b977bdb
  29. stickies-v commented at 11:17 am on December 9, 2025: contributor

    I don’t think there is a behavior change here.

    Yes you’re right, thanks for pointing it out, updated my comment.

  30. log: don't rate-limit "new peer" with -debug=net
    Previously, when `debug=net` is enabled, we log "New [..] peer connected"
    for new inbound peers with `LogInfo`. However, `LogInfo` will get
    rate-limited since https://github.com/bitcoin/bitcoin/pull/32604.
    When we specifically turn on `debug=net`, we don't want these log
    messages to be rate-limited.
    
    To fix this, use `LogDebug(BCLog::NET, ...)` for potentially high-
    rate inbound connections. Otherwise use `LogInfo`. This means we
    don't rate-limit the messages for inbound peers when `debug=net`
    is turned on but will rate-limit if we created outbound at a high
    rate as these are logged via `LogInfo`.
    
    --
    
    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.
    
    Co-Authored-By: Eugene Siegel <elzeigel@gmail.com>
    Co-Authored-By: Anthony Towns <aj@erisian.com.au>
    d4d184eda9
  31. 0xB10C force-pushed on Dec 9, 2025
  32. 0xB10C commented at 12:11 pm on December 9, 2025: contributor

    The only behavior change is the added [net] in [net] New inbound peer …, no?

    Correct


    pushed to fixup:

  33. stickies-v commented at 12:15 pm on December 9, 2025: contributor
    utACK d4d184eda9c0f73bc31ece07d5001d887b5c6914
  34. DrahtBot requested review from dergoegge on Dec 9, 2025
  35. Crypt-iQ commented at 4:19 pm on December 9, 2025: contributor
    tACK d4d184eda9c0f73bc31ece07d5001d887b5c6914
  36. maflcko commented at 4:47 pm on December 9, 2025: member

    review ACK d4d184eda9c0f73bc31ece07d5001d887b5c6914 🚲

    Signature:

    0untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
    1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    2trusted comment: review ACK d4d184eda9c0f73bc31ece07d5001d887b5c6914 🚲
    3/rBRlFzoUkxVkscFJZo0QXt3tdf/St0bfnaE+6JyTkhqE2aiIgKSvCAKlFUbk4ESJn5Fi3c6vXJV9OTm3gYCBQ==
    
  37. rkrux approved
  38. rkrux commented at 5:30 pm on December 9, 2025: contributor

    lgtm code review ACK d4d184eda9c0f73bc31ece07d5001d887b5c6914

    This PR is easier to reason about than the alternative #34018 that was raised because in that PR it took me some time to grasp the implications of that change.

  39. glozow commented at 7:15 pm on December 9, 2025: member
    lgtm ACK d4d184eda9c0f73bc31ece07d5001d887b5c6914
  40. glozow merged this on Dec 9, 2025
  41. glozow closed this on Dec 9, 2025

  42. 0xB10C deleted the branch on Dec 10, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-30 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me