Reduce log noise #34729

Manually merged
ajtowns merged 7 commits from 202603-logerror into master 2026-10-05 22:07:25 +00:00 AGit
ajtowns commented 2026-03-04 11:56:05 +00:00 (Migrated from github.com)

This set of changes reduces some of the exaggerated logging that was introduced in #29236 when "error()" logging was upgraded from LogPrintf (aka LogInfo) to LogError. It also introduces LogWarnThenDebug() which duplicates the behaviour of #34549 which issues a warning the first time the log line is hit, but downgrades that to categorized debug messages afterwards. This function is used for failures that are likely caused by system configuration problems (so likely degrade the node's functionality and warrant admin attention) but are triggered by remote activity and thus could occur frequently.

This set of changes reduces some of the exaggerated logging that was introduced in #29236 when "error()" logging was upgraded from `LogPrintf` (aka `LogInfo`) to `LogError`. It also introduces `LogWarnThenDebug()` which duplicates the behaviour of #34549 which issues a warning the first time the log line is hit, but downgrades that to categorized debug messages afterwards. This function is used for failures that are likely caused by system configuration problems (so likely degrade the node's functionality and warrant admin attention) but are triggered by remote activity and thus could occur frequently.
DrahtBot commented 2026-03-04 11:56:40 +00:00 (Migrated from github.com)

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

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK l0rinc, sedited, achow101
Stale ACK kevkevinpal, ryanofsky

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36434 (http: support unix sockets by pinheadmz)
  • #36002 (txindex: allow running in pruned mode by andrewtoth)
  • #35733 (sign: Remove FillableSigningProvider by achow101)
  • #35646 (RFC: Separate out runtime errors from BlockValidationState using util::Expected by yuvicc)
  • #34520 (refactor: Add nodiscard to functions returning bool+mutable ref by maflcko)
  • #30342 (kernel, logging: Deliver each context's log output to its own logging connection by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/34729 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/34729.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/34729#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [l0rinc](https://github.com/bitcoin/bitcoin/pull/34729#pullrequestreview-5408565087), [sedited](https://github.com/bitcoin/bitcoin/pull/34729#pullrequestreview-5414494282), [achow101](https://github.com/bitcoin/bitcoin/pull/34729#issuecomment-6003845433) | | Stale ACK | [kevkevinpal](https://github.com/bitcoin/bitcoin/pull/34729#pullrequestreview-3889901411), [ryanofsky](https://github.com/bitcoin/bitcoin/pull/34729#pullrequestreview-4699929573) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#36434](https://github.com/bitcoin/bitcoin/pull/36434) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36434.svg"></sub> (http: support unix sockets by pinheadmz) * [#36002](https://github.com/bitcoin/bitcoin/pull/36002) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36002.svg"></sub> (txindex: allow running in pruned mode by andrewtoth) * [#35733](https://github.com/bitcoin/bitcoin/pull/35733) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35733.svg"></sub> (sign: Remove FillableSigningProvider by achow101) * [#35646](https://github.com/bitcoin/bitcoin/pull/35646) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35646.svg"></sub> (RFC: Separate out runtime errors from BlockValidationState using `util::Expected` by yuvicc) * [#34520](https://github.com/bitcoin/bitcoin/pull/34520) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34520.svg"></sub> (refactor: Add [[nodiscard]] to functions returning bool+mutable ref by maflcko) * [#30342](https://github.com/bitcoin/bitcoin/pull/30342) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/30342.svg"></sub> (kernel, logging: Deliver each context's log output to its own logging connection by ryanofsky) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3-->
ajtowns commented 2026-03-04 11:59:31 +00:00 (Migrated from github.com)

See #30348 for further background; I think the changes here should be able to stand on their own merits. I haven't addressed cases where there's ambiguity between LogWarning and LogError here, but if there are other current cases where things are at Warning/Error and should be Info, or at Warning/Error/Info and should be Debug, happy to add them to this PR.

See #30348 for further background; I think the changes here should be able to stand on their own merits. I haven't addressed cases where there's ambiguity between LogWarning and LogError here, but if there are other current cases where things are at Warning/Error and should be Info, or at Warning/Error/Info and should be Debug, happy to add them to this PR.
kevkevinpal (Migrated from github.com) reviewed 2026-03-04 15:00:53 +00:00
kevkevinpal (Migrated from github.com) left a comment

ACK c665935d02b633032147e58436e3a1c6511d64f3

This is a good improvement on the amount of functional code dedicated to logging. Also, the LogWarnThenDebug log will be useful in future cases to help avoid log noise

Added two comments about potentially adding BCLog::VALIDATION to the two validation logs touched

ACK c665935d02b633032147e58436e3a1c6511d64f3 This is a good improvement on the amount of functional code dedicated to logging. Also, the `LogWarnThenDebug` log will be useful in future cases to help avoid log noise Added two comments about potentially adding `BCLog::VALIDATION` to the two validation logs touched
kevkevinpal (Migrated from github.com) commented 2026-03-04 14:48:02 +00:00
            LogWarning(BCLog::VALIDATION, %s: Missing input %d in transaction \'%s\'", __func__, i, tx.GetHash().GetHex());
```suggestion LogWarning(BCLog::VALIDATION, %s: Missing input %d in transaction \'%s\'", __func__, i, tx.GetHash().GetHex()); ```
kevkevinpal (Migrated from github.com) commented 2026-03-04 14:48:20 +00:00
        LogWarning(BCLog::VALIDATION, "Block validation error: %s", state.ToString());
```suggestion LogWarning(BCLog::VALIDATION, "Block validation error: %s", state.ToString()); ```
ajtowns (Migrated from github.com) reviewed 2026-03-05 03:12:16 +00:00
ajtowns (Migrated from github.com) commented 2026-03-05 03:12:16 +00:00

LogWarning doesn't accept a filter category because it isn't filterable.

LogWarning doesn't accept a filter category because it isn't filterable.
ajtowns (Migrated from github.com) reviewed 2026-03-05 03:12:34 +00:00
ajtowns (Migrated from github.com) commented 2026-03-05 03:12:34 +00:00

LogWarning doesn't accept a filter category because it isn't filterable.

LogWarning doesn't accept a filter category because it isn't filterable.
kevkevinpal (Migrated from github.com) reviewed 2026-03-06 02:41:12 +00:00
kevkevinpal (Migrated from github.com) commented 2026-03-06 02:41:12 +00:00

Ahh ya my bad. Also, it makes sense to have only debug logs to be filterable since warnings and errors should always be seen.

Ahh ya my bad. Also, it makes sense to have only debug logs to be filterable since warnings and errors should always be seen.
ryanofsky (Migrated from github.com) approved these changes 2026-03-06 20:28:26 +00:00
ryanofsky (Migrated from github.com) left a comment

Code review ACK c665935d02b633032147e58436e3a1c6511d64f3, Concept -0. Changes here seem logical overall, and I left comments the few places where I had concerns. The LogWarnThenDebug macro also seems cool and potentially useful more places.

The thing I don’t like about this change is that it makes it harder to see if messages are errors or warnings or normal notifications. Being able to see [error] and [warning] tags is a nice feature that is unfortunate to lose. 1

In an ideal world I would use LogWarning and LogError macros more places rather than fewer. I would also make LogWarning and LogError messages configurable and not always shown, and add a LogCritical level for truly critical messages that should always be shown even when debug logging is off.

That said, this PR seems fine overall: some positives, some negatives, and the code changes look ok.


  1. Note that a message’s error/warning/info status is orthogonal to its priority. A message could describe a normal condition (info), an unexpected condition (warning), or a failure condition (error), and any of these messages could have high or low priority depending how important the information is, whether the condition is temporary or permanent, what side effects it could lead to, and whether it might require manual intervention. ↩︎

Code review ACK c665935d02b633032147e58436e3a1c6511d64f3, Concept -0. Changes here seem logical overall, and I left comments the few places where I had concerns. The `LogWarnThenDebug` macro also seems cool and potentially useful more places. The thing I don’t like about this change is that it makes it harder to see if messages are errors or warnings or normal notifications. Being able to see `[error]` and `[warning]` tags is a nice feature that is unfortunate to lose. [^1] In an ideal world I would use `LogWarning` and `LogError` macros **more** places rather than fewer. I would also make `LogWarning` and `LogError` messages configurable and not always shown, and add a `LogCritical` level for truly critical messages that should always be shown even when debug logging is off. That said, this PR seems fine overall: some positives, some negatives, and the code changes look ok. [^1]: Note that a message’s error/warning/info status is orthogonal to its priority. A message could describe a normal condition (info), an unexpected condition (warning), or a failure condition (error), and any of these messages could have high or low priority depending how important the information is, whether the condition is temporary or permanent, what side effects it could lead to, and whether it might require manual intervention.
ryanofsky (Migrated from github.com) commented 2026-03-06 17:48:59 +00:00

In commit "script: Lower level of oversized redeemScript log, push errors to callers" (c02d58966796c80a37d745957e37d5134d0c093d)

It seems good to throw an error here though text of this message doesn't seem ideal. Redeemscript blob is potentially large and earler logged message seems more helpful (though I'm not sure if logs are shown in bitcoin-tx so it might also be useless). Might want to add another TODO comment here to improve

In commit "script: Lower level of oversized redeemScript log, push errors to callers" (c02d58966796c80a37d745957e37d5134d0c093d) It seems good to throw an error here though text of this message doesn't seem ideal. Redeemscript blob is potentially large and earler logged message seems more helpful (though I'm not sure if logs are shown in bitcoin-tx so it might also be useless). Might want to add another TODO comment here to improve
ryanofsky (Migrated from github.com) commented 2026-03-06 17:17:32 +00:00

In commit "netbase: Tidy up logging levels" (436bc942d362aefbf7315c73f74d032dcb75f435)

Maybe prefix this with Error: to indicate a problem has occurred and distinguish this from informational debug messages

Would suggest the same for other some messages below that aren't clearly labeled as error or failures.

In commit "netbase: Tidy up logging levels" (436bc942d362aefbf7315c73f74d032dcb75f435) Maybe prefix this with `Error:` to indicate a problem has occurred and distinguish this from informational debug messages Would suggest the same for other some messages below that aren't clearly labeled as error or failures.
ryanofsky (Migrated from github.com) commented 2026-03-06 17:30:43 +00:00

In commit "netbase: Reduce levels of socks5 error logging" (75674718fd35102be0db288802c7dc3af57ca986)

If this is an error communicating with the proxy server (as opposed to an error with the proxy server making a remote connection), it would seem potentially important for the user to know about so they can fix the problem with the server. Hiding this could make problems harder to diagnose, and it might be better to keep the previous level

In commit "netbase: Reduce levels of socks5 error logging" (75674718fd35102be0db288802c7dc3af57ca986) If this is an error communicating with the proxy server (as opposed to an error with the proxy server making a remote connection), it would seem potentially important for the user to know about so they can fix the problem with the server. Hiding this could make problems harder to diagnose, and it might be better to keep the previous level
ryanofsky (Migrated from github.com) commented 2026-03-06 17:38:03 +00:00

In commit "netbase: Tidy up logging levels" (436bc942d362aefbf7315c73f74d032dcb75f435)

This change seems ok, but if the goal in the commit message is to use higher levels for errors "that may be due to system misconfiguration" I don't know why this socket error would be more likely to be the result of misconfiguration than SO_NOSIGPIPE above, or if something else account for the difference like this error being considered more severe?

In commit "netbase: Tidy up logging levels" (436bc942d362aefbf7315c73f74d032dcb75f435) This change seems ok, but if the goal in the commit message is to use higher levels for errors "that may be due to system misconfiguration" I don't know why this socket error would be more likely to be the result of misconfiguration than SO_NOSIGPIPE above, or if something else account for the difference like this error being considered more severe?
ryanofsky (Migrated from github.com) commented 2026-03-06 19:07:01 +00:00

In commit "netbase: Reduce levels of socks5 error logging" (75674718fd35102be0db288802c7dc3af57ca986)

I’m not sure LogWarnThenDebug() is the best fit here. Compared to the earlier uses in this commit and the previous one, this seems less like a persistent configuration problem and more like something that could be intermittent, e.g. due to hitting resource limits.

In that case, warning exactly once and never again may hide recurring failures. It would seem better to have a rate limit and show the error once per hour or once per day while it is still occurring, not to just show it once and never again for the lifetime of the process. Absent that, keeping this at info/warning/error level might be safer.

In commit "netbase: Reduce levels of socks5 error logging" (75674718fd35102be0db288802c7dc3af57ca986) I’m not sure `LogWarnThenDebug()` is the best fit here. Compared to the earlier uses in this commit and the previous one, this seems less like a persistent configuration problem and more like something that could be intermittent, e.g. due to hitting resource limits. In that case, warning exactly once and never again may hide recurring failures. It would seem better to have a rate limit and show the error once per hour or once per day while it is still occurring, not to just show it once and never again for the lifetime of the process. Absent that, keeping this at info/warning/error level might be safer.
ajtowns (Migrated from github.com) reviewed 2026-03-09 13:27:48 +00:00
ajtowns (Migrated from github.com) commented 2026-03-09 13:27:48 +00:00

The SO_NOSIGPIPE error is marked as "continuing anyway", rather than immediately failing the connection, which seems fairly straightforwardly less severe.

The `SO_NOSIGPIPE` error is marked as "continuing anyway", rather than immediately failing the connection, which seems fairly straightforwardly less severe.
sedited (Migrated from github.com) reviewed 2026-03-11 13:21:21 +00:00
sedited (Migrated from github.com) commented 2026-03-11 13:21:21 +00:00

In commit 436bc942d362aefbf7315c73f74d032dcb75f435

I'm a bit confused when you are choosing Debug and when WarnThenDebug in this commit. What is the difference between these cases?

In commit 436bc942d362aefbf7315c73f74d032dcb75f435 I'm a bit confused when you are choosing Debug and when WarnThenDebug in this commit. What is the difference between these cases?
ajtowns (Migrated from github.com) reviewed 2026-03-11 21:21:38 +00:00
ajtowns (Migrated from github.com) commented 2026-03-11 21:21:38 +00:00

Proxy::Connect failing means you can't connect to the proxy you've configured, which seems likely to be a fairly serious problem for your node, and that error is likely the thing you need to see; ConnectDirectly failing might also be a severe problem, but it might also just be that you're trying to connect over ipv6 because your node says "why not?" but your OS says "no way", which is not really problematic at all. Note that CreateSock is CreateSockOS which mostly has LogWarnThenDebug before it returns nullptr as well.

Not particularly wedded to any particular choices here, these were just my best guesses.

`Proxy::Connect` failing means you can't connect to the proxy you've configured, which seems likely to be a fairly serious problem for your node, and that error is likely the thing you need to see; `ConnectDirectly` failing might also be a severe problem, but it might also just be that you're trying to connect over ipv6 because your node says "why not?" but your OS says "no way", which is not really problematic at all. Note that `CreateSock` is `CreateSockOS` which mostly has `LogWarnThenDebug` before it returns nullptr as well. Not particularly wedded to any particular choices here, these were just my best guesses.
sedited (Migrated from github.com) reviewed 2026-03-13 10:13:40 +00:00
sedited (Migrated from github.com) commented 2026-03-13 10:13:40 +00:00

Thanks for elaborating. Makes sense to me.

Thanks for elaborating. Makes sense to me.
sedited (Migrated from github.com) approved these changes 2026-05-10 11:26:41 +00:00
sedited (Migrated from github.com) left a comment

ACK 5359a99eb9b5bd442daee6c35d133ee5ea9f6583

ACK 5359a99eb9b5bd442daee6c35d133ee5ea9f6583
l0rinc (Migrated from github.com) approved these changes 2026-05-12 12:40:19 +00:00
l0rinc (Migrated from github.com) left a comment

The changes make sense to me, Concept ACK.
I would also be fine merging as-is, but please consider the few remaining comments.

The changes make sense to me, Concept ACK. I would also be fine merging as-is, but please consider the few remaining comments.
l0rinc (Migrated from github.com) commented 2026-05-12 11:22:10 +00:00

e054403 util/log: Add LogWarnThenDebug() helper:

Nit: the Log prefix is kinda redundant, but it is consistent with the existing functions, so in this PR it makes sense to keep it (maybe in a follow-up we could remove it).

> [e054403](https://github.com/bitcoin/bitcoin/pull/34729/changes/e054403acc07b3b2f24e0e8f7fc89456e2f51b23) _util/log: Add LogWarnThenDebug() helper_: Nit: the `Log` prefix is kinda redundant, but it *is* consistent with the existing functions, so in this PR it makes sense to keep it (maybe in a follow-up we could remove it).
l0rinc (Migrated from github.com) commented 2026-05-12 12:23:56 +00:00

yeah, maybe something like:

                    throw std::runtime_error(strprintf("invalid redeemScript: exceeds maximum size of %d bytes", MAX_SCRIPT_ELEMENT_SIZE));
yeah, maybe something like: ```suggestion throw std::runtime_error(strprintf("invalid redeemScript: exceeds maximum size of %d bytes", MAX_SCRIPT_ELEMENT_SIZE)); ```
l0rinc (Migrated from github.com) commented 2026-05-12 12:27:55 +00:00

4410a0e txindex: Downgrade log messages and include index name:

We've added the index names, maybe we could add a bit more info:

        LogWarning("%s: failed to open block file for tx %s at %s",
                   GetName(), tx_hash.ToString(), postx.ToString());

and the later ones:

        LogWarning("%s: failed to read tx %s at %s offset %s: %s",
                   GetName(), tx_hash.ToString(), postx.ToString(), postx.nTxOffset, e.what());

and

        LogWarning("%s: txid mismatch for tx %s at %s offset %s (read %s)",
                   GetName(), tx_hash.ToString(), postx.ToString(), postx.nTxOffset, tx->GetHash().ToString());
> [4410a0e](https://github.com/bitcoin/bitcoin/pull/34729/changes/4410a0e8aadde801b9852664e02c724362f6eb69) _txindex: Downgrade log messages and include index name_: We've added the index names, maybe we could add a bit more info: ```suggestion LogWarning("%s: failed to open block file for tx %s at %s", GetName(), tx_hash.ToString(), postx.ToString()); ``` and the later ones: ```C++ LogWarning("%s: failed to read tx %s at %s offset %s: %s", GetName(), tx_hash.ToString(), postx.ToString(), postx.nTxOffset, e.what()); ``` and ```C++ LogWarning("%s: txid mismatch for tx %s at %s offset %s (read %s)", GetName(), tx_hash.ToString(), postx.ToString(), postx.nTxOffset, tx->GetHash().ToString()); ```
l0rinc (Migrated from github.com) commented 2026-05-12 12:01:39 +00:00

9bc68e5 kernel/coinstats: Downgrade ComputeUTXOStates log level:

Commit message nit: ComputeUTXOStates -> ComputeUTXOStats

> [9bc68e5](https://github.com/bitcoin/bitcoin/pull/34729/changes/9bc68e566284ab8841694c7508cfccc6009e2af0) _kernel/coinstats: Downgrade ComputeUTXOStates log level_: Commit message nit: `ComputeUTXOStates` -> `ComputeUTXOStats`
l0rinc (Migrated from github.com) commented 2026-05-12 11:54:31 +00:00

9bc68e5 kernel/coinstats: Downgrade ComputeUTXOStates log level:

It seems to me that every single caller checks the result, usually returning an Error or throwing, so demoting this makes sense. Maybe we could extend the commit message with this info.

For consistency with other similar "unable to read" messages, and to continue our __func__ removals, maybe we could adjust this to something like:

            LogDebug(BCLog::COINDB, "ComputeUTXOStats: unable to read value for key %s", key.ToString());
> [9bc68e5](https://github.com/bitcoin/bitcoin/pull/34729/changes/9bc68e566284ab8841694c7508cfccc6009e2af0) _kernel/coinstats: Downgrade ComputeUTXOStates log level_: It seems to me that every single caller checks the result, usually returning an `Error` or throwing, so demoting this makes sense. Maybe we could extend the commit message with this info. For consistency with other similar "unable to read" messages, and to continue our `__func__` removals, maybe we could adjust this to something like: ```suggestion LogDebug(BCLog::COINDB, "ComputeUTXOStats: unable to read value for key %s", key.ToString()); ```
l0rinc (Migrated from github.com) commented 2026-05-12 11:12:40 +00:00

ec2a8c7 netbase: Reduce levels of socks5 error logging:

Given that the original authors thought these should be errors, we could add short commit message explanations to clarify why these (expected?) conditions are no longer treated as serious errors. Obviously, no need to overdo it, but maybe add a short summary of your GitHub comments about the categories and constraints you've considered.

> [ec2a8c7](https://github.com/bitcoin/bitcoin/pull/34729/changes/ec2a8c72150b2eb0b32ab9eda31d7658fe898246) _netbase: Reduce levels of socks5 error logging_: Given that the original authors thought these should be errors, we could add short commit message explanations to clarify why these (expected?) conditions are no longer treated as serious errors. Obviously, no need to overdo it, but maybe add a short summary of your GitHub comments about the categories and constraints you've considered.
l0rinc (Migrated from github.com) commented 2026-05-12 11:14:35 +00:00

Not sure about this. Wouldn't that just blur the line between what's an error, what's a warning, and what's info and debug? Wouldn't LogWarnThenDebug suffice for that case?

Not sure about this. Wouldn't that just blur the line between what's an error, what's a warning, and what's info and debug? Wouldn't `LogWarnThenDebug` suffice for that case?
l0rinc (Migrated from github.com) commented 2026-05-12 12:32:15 +00:00

ec2a8c7 netbase: Reduce levels of socks5 error logging:

Slightly unrelated, but some connection-management diagnostics outside netbase may still be repeated in logs for ordinary retries, e.g. github.com/bitcoin/bitcoin@10ca73c02c/src/net.cpp (L394)
Maybe we could also change this one to something like:

LogDebug(BCLog::NET, "Failed to open new connection to %s, already connected", addrConnect.ToStringAddrPort());
> [ec2a8c7](https://github.com/bitcoin/bitcoin/pull/34729/changes/ec2a8c72150b2eb0b32ab9eda31d7658fe898246) _netbase: Reduce levels of socks5 error logging_: Slightly unrelated, but some connection-management diagnostics outside `netbase` may still be repeated in logs for ordinary retries, e.g. https://github.com/bitcoin/bitcoin/blob/10ca73c02cbff59f2134c0c7da3b8d0a7e727475/src/net.cpp#L394 Maybe we could also change this one to something like: ```C++ LogDebug(BCLog::NET, "Failed to open new connection to %s, already connected", addrConnect.ToStringAddrPort()); ```
Lines 984-990
l0rinc (Migrated from github.com) commented 2026-05-12 11:46:25 +00:00

0591112 netbase: Tidy up logging levels:

Since we're already modifying it, maybe we could make it consistent with other similar calls and log the error:

    if (sock.GetSockName(sa, &len) != 0) {
        LogWarning("GetSockName failed: %s", NetworkErrorString(WSAGetLastError()));
    } else {
        addr_bind.SetSockAddr(sa, len);
    }
> [0591112](https://github.com/bitcoin/bitcoin/pull/34729/changes/05911121b7ef1cb0f82a7951b847c1e2567176b6) _netbase: Tidy up logging levels_: Since we're already modifying it, maybe we could make it consistent with other similar calls and log the error: ```suggestion if (sock.GetSockName(sa, &len) != 0) { LogWarning("GetSockName failed: %s", NetworkErrorString(WSAGetLastError())); } else { addr_bind.SetSockAddr(sa, len); } ```
Lines 135-142
l0rinc (Migrated from github.com) commented 2026-05-12 12:19:56 +00:00

e054403 util/log: Add LogWarnThenDebug() helper:

nit: The current _warned flag names the second state, so the first branch has to be expressed as a negation.
Could this instead track whether the call site should still warn? That keeps the first-warning branch first and makes the condition read directly:

    do { \
        static std::atomic_bool _should_warn{true}; \
        if (_should_warn.exchange(false)) { \
            LogWarning(__VA_ARGS__); \
        } else { \
            LogDebug(category, __VA_ARGS__); \
        } \
    } while (0)

nit1: The formatting seems a bit off compared to detail_LogIfCategoryAndLevelEnabled, by one space per indentation level.
nit2: We could use static std::atomic_bool _warned{false} here instead and add #include <atomic>.
nit3: while is not a function, so I added a space after it.

> [e054403](https://github.com/bitcoin/bitcoin/pull/34729/changes/e054403acc07b3b2f24e0e8f7fc89456e2f51b23) _util/log: Add LogWarnThenDebug() helper_: nit: The current `_warned` flag names the second state, so the first branch has to be expressed as a negation. Could this instead track whether the call site should still warn? That keeps the first-warning branch first and makes the condition read directly: ```suggestion do { \ static std::atomic_bool _should_warn{true}; \ if (_should_warn.exchange(false)) { \ LogWarning(__VA_ARGS__); \ } else { \ LogDebug(category, __VA_ARGS__); \ } \ } while (0) ``` nit1: The formatting seems a bit off compared to `detail_LogIfCategoryAndLevelEnabled`, by one space per indentation level. nit2: We could use `static std::atomic_bool _warned{false}` here instead and add `#include <atomic>`. nit3: `while` is not a function, so I added a space after it.
l0rinc (Migrated from github.com) commented 2026-05-12 12:08:51 +00:00

e054403 util/log: Add LogWarnThenDebug() helper:

Could we test the behavior of this newly added logger with a simple unit test, something like:

namespace {
void LogWarnThenDebugFromSameLocation(std::string_view message)
{
    LogWarnThenDebug(BCLog::NET, "warn_then_debug: %s", message);
}
} // namespace
BOOST_FIXTURE_TEST_CASE(logging_LogWarnThenDebug, LogSetup)
{
    LogWarnThenDebugFromSameLocation("first");
    LogWarnThenDebugFromSameLocation("suppressed");

    LogInstance().EnableCategory(BCLog::NET);
    LogWarnThenDebugFromSameLocation("debug");

    std::vector log_lines{ReadDebugLogLines()};
    std::vector<std::string> expected = {
        "[warning] warn_then_debug: first",
        "[net] warn_then_debug: debug",
    };
    BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end());
}
> [e054403](https://github.com/bitcoin/bitcoin/pull/34729/changes/e054403acc07b3b2f24e0e8f7fc89456e2f51b23) _util/log: Add LogWarnThenDebug() helper_: Could we test the behavior of this newly added logger with a simple unit test, something like: ```C++ namespace { void LogWarnThenDebugFromSameLocation(std::string_view message) { LogWarnThenDebug(BCLog::NET, "warn_then_debug: %s", message); } } // namespace BOOST_FIXTURE_TEST_CASE(logging_LogWarnThenDebug, LogSetup) { LogWarnThenDebugFromSameLocation("first"); LogWarnThenDebugFromSameLocation("suppressed"); LogInstance().EnableCategory(BCLog::NET); LogWarnThenDebugFromSameLocation("debug"); std::vector log_lines{ReadDebugLogLines()}; std::vector<std::string> expected = { "[warning] warn_then_debug: first", "[net] warn_then_debug: debug", }; BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end()); } ```
ajtowns (Migrated from github.com) reviewed 2026-05-12 13:38:55 +00:00
ajtowns (Migrated from github.com) commented 2026-05-12 13:38:55 +00:00

The original authors tagged them with "ERROR:" via the error() helper, which was accurate -- they're not things that are expected to happen in normal usage, and error() just added some log text and an early exit. That was changed to invoke LogError in #29236 which was not correct per the definition of that function in the docs, and this PR just corrects that.

The original authors tagged them with "ERROR:" via the `error()` helper, which was accurate -- they're not things that are expected to happen in normal usage, and `error()` just added some log text and an early exit. That was changed to invoke `LogError` in #29236 which was not correct per the definition of that function in the docs, and this PR just corrects that.
ryanofsky (Migrated from github.com) reviewed 2026-05-18 17:30:34 +00:00
ryanofsky (Migrated from github.com) left a comment

Code review ACK 5359a99eb9b5bd442daee6c35d133ee5ea9f6583. Concept -0 as explained in previous review (because this makes it harder to tell when errors are happening). No changes since previous review other than rebase.

Code review ACK 5359a99eb9b5bd442daee6c35d133ee5ea9f6583. Concept -0 as explained in [previous review](https://github.com/bitcoin/bitcoin/pull/34729#pullrequestreview-3904982911) (because this makes it harder to tell when errors are happening). No changes since previous review other than rebase.
ryanofsky (Migrated from github.com) commented 2026-05-18 17:21:31 +00:00

re: https://github.com/bitcoin/bitcoin/pull/34729#discussion_r3225902706

Not sure about this. Wouldn't that just blur the line between what's an error, what's a warning, and what's info and debug? Wouldn't LogWarnThenDebug suffice for that case?

I just think we should make it easy to distinguish failure messages from status messages. So I'd agree LogWarnThenDebug would be an improvement because it would provide a clearer indication that something is wrong.

But I think you should be allowed to use the word "Error" even if you are not literally calling the LogError macro. I've said elsewhere the LogError macro is poorly named for what it's it's currently intended to be used for (severe errors causing the node to not function), and think a name like LogCritical would be better.

re: https://github.com/bitcoin/bitcoin/pull/34729#discussion_r3225902706 > Not sure about this. Wouldn't that just blur the line between what's an error, what's a warning, and what's info and debug? Wouldn't `LogWarnThenDebug` suffice for that case? I just think we should make it easy to distinguish failure messages from status messages. So I'd agree `LogWarnThenDebug` would be an improvement because it would provide a clearer indication that something is wrong. But I think you should be allowed to use the word "Error" even if you are not literally calling the `LogError` macro. I've said elsewhere the `LogError` macro is poorly named for what it's it's currently intended to be used for (severe errors causing the node to not function), and think a name like `LogCritical` would be better.
achow101 commented 2026-05-20 23:09:12 +00:00 (Migrated from github.com)

@ajtowns do you want to address the remaining comments here?

@ajtowns do you want to address the remaining comments here?
ajtowns (Migrated from github.com) reviewed 2026-05-28 07:42:33 +00:00
Lines 135-142
ajtowns (Migrated from github.com) commented 2026-05-28 07:42:33 +00:00

I think it's clearer as is -- the condition is that if we haven't already warned, we warn, and if we have we do a debug log. The warn goes in the first branch because it's the first thing we do, and the condition is negated, because of the "not" in "haven't already warned".

I think it's clearer as is -- the condition is that if we haven't already warned, we warn, and if we have we do a debug log. The warn goes in the first branch because it's the first thing we do, and the condition is negated, because of the "not" in "haven't already warned".
ajtowns (Migrated from github.com) reviewed 2026-05-28 07:51:38 +00:00
ajtowns (Migrated from github.com) commented 2026-05-28 07:51:38 +00:00

Taken.

Taken.
ajtowns (Migrated from github.com) reviewed 2026-05-28 07:58:12 +00:00
ajtowns (Migrated from github.com) commented 2026-05-28 07:58:12 +00:00

We already had #29236 being overzealous in equating "error" with LogError, so I don't think it would be smart to set things up for that to happen again. Combining and renaming LogError/LogWarning to LogAlert/LogCritical/LogKablooie/whatever (eg #34730) might make the distinction clearer and reduce the risk of confusion though.

We already had #29236 being overzealous in equating "error" with `LogError`, so I don't think it would be smart to set things up for that to happen again. Combining and renaming LogError/LogWarning to LogAlert/LogCritical/LogKablooie/whatever (eg #34730) might make the distinction clearer and reduce the risk of confusion though.
ajtowns (Migrated from github.com) reviewed 2026-05-28 08:08:50 +00:00
ajtowns (Migrated from github.com) commented 2026-05-28 08:08:50 +00:00

As far as I can see, you'll only get an this error in bitcoin-tx if you deliberately feed it an overly large redeemscript via the set register command, so if you get ~14 lines of error message because you deliberately fed it ~14 lines of redeemscript, that doesn't seem very problematic.

bitcoin-tx doesn't show log lines (it doesn't call StartLogging).

As far as I can see, you'll only get an this error in bitcoin-tx if you deliberately feed it an overly large redeemscript via the `set` register command, so if you get ~14 lines of error message because you deliberately fed it ~14 lines of redeemscript, that doesn't seem very problematic. bitcoin-tx doesn't show log lines (it doesn't call `StartLogging`).
ajtowns commented 2026-05-28 08:51:39 +00:00 (Migrated from github.com)

Rebased, addressed some feedback (LogWarnThenDebug test particularly). I think non-trivial improvements to the wording/information provided in these (and related) log messages are better left for a separate PR.

Rebased, addressed some feedback (LogWarnThenDebug test particularly). I think non-trivial improvements to the wording/information provided in these (and related) log messages are better left for a separate PR.
sedited (Migrated from github.com) approved these changes 2026-06-24 20:05:05 +00:00
sedited (Migrated from github.com) left a comment

Re-ACK 8d60c1428507921d9dd70c9840c41e447649268f

Re-ACK 8d60c1428507921d9dd70c9840c41e447649268f
l0rinc (Migrated from github.com) approved these changes 2026-06-26 19:46:50 +00:00
l0rinc (Migrated from github.com) left a comment

lightly tested ACK 8d60c1428507921d9dd70c9840c41e447649268f

Not all of the comments have been replied to, but I assumed the change is ready for re-review anyway.
I have slightly different takes on a few decisions here, but no strong opinion either way. I focused mostly on correctness, style, utility, and consistency - the world is a slightly better place after this change.
I'm personally fine with merging as-is, but would be interested in @ryanofsky's opinion here, given how many PRs are in conflict with this one.

lightly tested ACK 8d60c1428507921d9dd70c9840c41e447649268f Not all of the comments have been replied to, but I assumed the change is ready for re-review anyway. I have slightly different takes on a few decisions here, but no strong opinion either way. I focused mostly on correctness, style, utility, and consistency - the world is a slightly better place after this change. I'm personally fine with merging as-is, but would be interested in @ryanofsky's opinion here, given how many PRs are in conflict with this one.
l0rinc (Migrated from github.com) commented 2026-06-26 18:42:23 +00:00

nit: redeemScripts -> redeemScript
nit2: would probably be interesting to show the invalid size

        LogInfo("FillableSigningProvider::AddCScript(): redeemScript exceeds size limit: %d > %d", redeemScript.size(), MAX_SCRIPT_ELEMENT_SIZE); // TODO: remove, ...
nit: `redeemScripts` -> `redeemScript` nit2: would probably be interesting to show the invalid size ```suggestion LogInfo("FillableSigningProvider::AddCScript(): redeemScript exceeds size limit: %d > %d", redeemScript.size(), MAX_SCRIPT_ELEMENT_SIZE); // TODO: remove, ... ```
Lines 135-142
l0rinc (Migrated from github.com) commented 2026-06-24 22:09:15 +00:00

because of the "not" in "haven't already warned"

Yes, my point was avoiding double negation:

-if (!_warned.exchange(true)) { \
+if (_should_warn.exchange(false)) {
> because of the "not" in "haven't already warned" Yes, my point was avoiding double negation: ```patch -if (!_warned.exchange(true)) { \ +if (_should_warn.exchange(false)) { ```
l0rinc (Migrated from github.com) commented 2026-06-26 19:00:26 +00:00

b5689ce util/log: Add LogWarnThenDebug() helper:

Seems to me #include <atomic> is missing here

> [b5689ce](https://github.com/bitcoin/bitcoin/pull/34729/changes/b5689ce8a00bb52fd927782940c7c9bc69d78b43) _util/log: Add LogWarnThenDebug() helper_: Seems to me `#include <atomic>` is missing here
l0rinc (Migrated from github.com) commented 2026-06-26 18:57:11 +00:00

05b429e script: Lower level of oversized redeemScript log, push errors to callers:

Hmmm, something's off here.
First, change doesn't seem like "log noise reduction" - but that could be fine if it's setting up a follow up -, but the test is actually passing with:

bool FillableSigningProvider::AddCScript(const CScript& redeemScript) { return false; }

i.e. without the call:

diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
--- a/src/wallet/test/wallet_tests.cpp	(revision a0a29a62d47a6211c41ac6ad4dbabe8cf91ba9f3)
+++ b/src/wallet/test/wallet_tests.cpp	(revision 8515753627e2db958cd3a455248ad6d09e1571c2)
@@ -516,9 +516,8 @@
     uint160 script_id(Hash160(inner_script));
     CScript script_pubkey = CScript() << OP_HASH160 << std::vector<unsigned char>(script_id.begin(), script_id.end()) << OP_EQUAL;
 
-    // Add inner-script to key store and key to watchonly
+    // Add key to key store; related scripts are learned implicitly.
     FillableSigningProvider keystore;
-    BOOST_CHECK(keystore.AddCScript(inner_script));
     keystore.AddKeyPubKey(key, pubkey);
 
     // Fill in dummy signatures for fee calculation.

The reason is that keystore.AddKeyPubKey calls ImplicitlyLearnRelatedKeyScripts which just overrides (or populates if the above patch is taken) mapScripts with the script.
It seems to me removing the line is a simpler fix that addin a check.
(cc: @instagibbs)

> [05b429e](https://github.com/bitcoin/bitcoin/pull/34729/changes/05b429eefc38f3b1030032e6cb5b009a12c563eb) _script: Lower level of oversized redeemScript log, push errors to callers_: Hmmm, something's off here. First, change doesn't seem like "log noise reduction" - but that could be fine if it's setting up a follow up -, but the test is actually passing with: ```C++ bool FillableSigningProvider::AddCScript(const CScript& redeemScript) { return false; } ``` i.e. without the call: ```patch diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp --- a/src/wallet/test/wallet_tests.cpp (revision a0a29a62d47a6211c41ac6ad4dbabe8cf91ba9f3) +++ b/src/wallet/test/wallet_tests.cpp (revision 8515753627e2db958cd3a455248ad6d09e1571c2) @@ -516,9 +516,8 @@ uint160 script_id(Hash160(inner_script)); CScript script_pubkey = CScript() << OP_HASH160 << std::vector<unsigned char>(script_id.begin(), script_id.end()) << OP_EQUAL; - // Add inner-script to key store and key to watchonly + // Add key to key store; related scripts are learned implicitly. FillableSigningProvider keystore; - BOOST_CHECK(keystore.AddCScript(inner_script)); keystore.AddKeyPubKey(key, pubkey); // Fill in dummy signatures for fee calculation. ``` The reason is that `keystore.AddKeyPubKey` calls `ImplicitlyLearnRelatedKeyScripts` which just overrides (or populates if the above patch is taken) `mapScripts` with the script. It seems to me removing the line is a simpler fix that addin a check. (cc: @instagibbs)
ryanofsky (Migrated from github.com) approved these changes 2026-07-15 01:01:29 +00:00
ryanofsky (Migrated from github.com) left a comment

Code review ACK 8d60c1428507921d9dd70c9840c41e447649268f. Approach -0 because this drops [error] and [warning] tags so now the log messages are harder to interpret. IMO, a better approach would keep [error] and [warning] levels but make them conditional, using a [critical] level for actually critical messages.

Since previous review, only changes are rebasing and adding test. I think the PR may be RFM if review comments are replied to and there aren't other objections.

Code review ACK 8d60c1428507921d9dd70c9840c41e447649268f. Approach -0 because this drops `[error]` and `[warning]` tags so now the log messages are harder to interpret. IMO, a better approach would keep `[error]` and `[warning]` levels but make them conditional, using a `[critical]` level for actually critical messages. Since previous review, only changes are rebasing and adding test. I think the PR may be RFM if review comments are replied to and there aren't other objections.
DrahtBot commented 2026-08-15 15:41:18 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
ajtowns (Migrated from github.com) reviewed 2026-08-15 19:48:51 +00:00
ajtowns (Migrated from github.com) commented 2026-08-15 19:48:51 +00:00

The change is just to ensure that the return value isn't discarded (due to the nodiscard addition), and because the inner_script is known and doesn't exceed the limit, we can rely on the return value being true and use BOOST_CHECK rather than (void).

The primary change here is reducing LogError for something that isn't going to abort a node or subsystem to LogInfo, but even that is overkill, so the [[nodiscard]] and comment set things up so the log message could be removed entirely in the future.

The change is just to ensure that the return value isn't discarded (due to the `nodiscard` addition), and because the inner_script is known and doesn't exceed the limit, we can rely on the return value being true and use `BOOST_CHECK` rather than `(void)`. The primary change here is reducing `LogError` for something that isn't going to abort a node or subsystem to `LogInfo`, but even that is overkill, so the `[[nodiscard]]` and comment set things up so the log message could be removed entirely in the future.
DrahtBot commented 2026-08-15 20:30:17 +00:00 (Migrated from github.com)

🚧 At least one of the CI tasks failed.
Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/31904474132/job/95060048027
LLM reason (✨ experimental): CI failed because the IWYU include-check reported a failure and caused formatting/IWYU changes (no-contentful-changes checks didn’t match), leading to an intentional false exit.

Hints

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.

<!--85328a0da195eb286784d51f73fa0af9--> 🚧 At least one of the CI tasks failed. <sub>Task `iwyu`: https://github.com/bitcoin/bitcoin/actions/runs/31904474132/job/95060048027</sub> <sub>LLM reason (✨ experimental): CI failed because the IWYU include-check reported a failure and caused formatting/IWYU changes (no-contentful-changes checks didn’t match), leading to an intentional `false` exit.</sub> <details><summary>Hints</summary> 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. </details>
First-time contributor

Base: 65896ac58ea63e29ad19d41b492e37f8722ac715
Head: 91f8b365e7e7887e59240651c2c76b1a64071233

Design and approach

Preserve visible diagnostics when socket creation fails (src/netbase.cpp:661, head)

When CreateSock fails, this branch logs only at NET debug level, even though manual_connection is available and LogConnectFailure retains Info-level messages for manual attempts. Manual connections reach this path, including TCP proxy connections that call ConnectDirectly with manual_connection=true. In particular, CreateSockOS returns null without logging if socket() returns INVALID_SOCKET, leaving this branch as the only diagnostic. Preserve a default-visible explanation for explicitly requested connections, and consider whether raw socket-allocation failures should receive the first-warning treatment used for other socket-setup failures. No concrete current occurrence of socket() returning INVALID_SOCKET was identified, so the production impact is unconfirmed.

Keep visible diagnostics for SOCKS5 protocol failures (src/netbase.cpp:419, head)

If the connected endpoint responds with a non-SOCKS5 version, this branch emits only PROXY debug output and returns failure. ConnectThroughProxy adds no default-level follow-up, and the same handshake path serves manually requested proxied connections; Socks5 does not receive the manual-connection distinction. Keep a first-visible diagnostic for clear protocol or configuration failures such as a wrong-version response, while leaving expected destination timeouts quiet. No current production response with a wrong SOCKS version was identified, so its real-world frequency and impact are unconfirmed.

Keep destination connection failures in the NET category (src/netbase.cpp:479, head)

This SOCKS5 CONNECT reply reports failure to connect to the destination peer, as the adjacent comment notes, but the message moved from NET to PROXY. Users who enable -debug=net will no longer see the reason unless they also enable PROXY, and ConnectThroughProxy adds no NET diagnostic for the handshake failure. Keep the reduced-severity message in NET and reserve PROXY for proxy-handshake failures. No specific current production proxy reply with a failure code was identified, so the frequency of this impact is unconfirmed.

Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial review had incomplete evidence.

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> Base: `65896ac58ea63e29ad19d41b492e37f8722ac715` Head: `91f8b365e7e7887e59240651c2c76b1a64071233` ##### Design and approach **Preserve visible diagnostics when socket creation fails** (src/netbase.cpp:661, head) When `CreateSock` fails, this branch logs only at NET debug level, even though `manual_connection` is available and `LogConnectFailure` retains Info-level messages for manual attempts. Manual connections reach this path, including TCP proxy connections that call `ConnectDirectly` with `manual_connection=true`. In particular, `CreateSockOS` returns null without logging if `socket()` returns `INVALID_SOCKET`, leaving this branch as the only diagnostic. Preserve a default-visible explanation for explicitly requested connections, and consider whether raw socket-allocation failures should receive the first-warning treatment used for other socket-setup failures. No concrete current occurrence of `socket()` returning `INVALID_SOCKET` was identified, so the production impact is unconfirmed. **Keep visible diagnostics for SOCKS5 protocol failures** (src/netbase.cpp:419, head) If the connected endpoint responds with a non-SOCKS5 version, this branch emits only PROXY debug output and returns failure. `ConnectThroughProxy` adds no default-level follow-up, and the same handshake path serves manually requested proxied connections; `Socks5` does not receive the manual-connection distinction. Keep a first-visible diagnostic for clear protocol or configuration failures such as a wrong-version response, while leaving expected destination timeouts quiet. No current production response with a wrong SOCKS version was identified, so its real-world frequency and impact are unconfirmed. **Keep destination connection failures in the NET category** (src/netbase.cpp:479, head) This SOCKS5 CONNECT reply reports failure to connect to the destination peer, as the adjacent comment notes, but the message moved from NET to PROXY. Users who enable `-debug=net` will no longer see the reason unless they also enable PROXY, and `ConnectThroughProxy` adds no NET diagnostic for the handshake failure. Keep the reduced-severity message in NET and reserve PROXY for proxy-handshake failures. No specific current production proxy reply with a failure code was identified, so the frequency of this impact is unconfirmed. Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial review had incomplete evidence. [Full review report](<https://review.fish.foo/traces/34729-91f8b365e7e7887e59240651c2c76b1a64071233-304-1.html>)
l0rinc (Migrated from github.com) approved these changes 2026-10-04 22:44:42 +00:00
l0rinc (Migrated from github.com) left a comment

lightweight re-ACK 91f8b365e7

Re-reviewed the diff and changes and previous suggestions, I don't have strong opinions, my remaining comments are non-blocking.

lightweight re-ACK 91f8b365e7e7887e59240651c2c76b1a64071233 Re-reviewed the diff and changes and previous suggestions, I don't have strong opinions, my remaining comments are non-blocking.
l0rinc (Migrated from github.com) commented 2026-10-04 22:32:20 +00:00

K, we can also fix it in a followup

K, we can also fix it in a followup
sedited (Migrated from github.com) approved these changes 2026-10-05 12:30:02 +00:00
sedited (Migrated from github.com) left a comment

Re-ACK 91f8b365e7

Re-ACK 91f8b365e7e7887e59240651c2c76b1a64071233
achow101 commented 2026-10-05 21:56:03 +00:00 (Migrated from github.com)
ACK 91f8b365e7e7887e59240651c2c76b1a64071233
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!34729
No description provided.