init: reject -noconnect double-negatives that become -connect=1 #35939

pull Avecci-Claussen wants to merge 2 commits into bitcoin:master from Avecci-Claussen:master changing 3 files +23 −0
  1. Avecci-Claussen commented at 7:15 PM on August 9, 2026: none

    Fixes #31426.

    Motivation

    -noconnect=0 is interpreted as -connect=1, which is interpreted as -connect=0.0.0.1

    bitcoind -noconnect=0 -debug=net
    

    before this change that leads to a connection attempt to 0.0.0.1 (and the usual -connect parameter interactions that disable listen/dnsseed). bitcoind should not try to connect to 0.0.0.1 from that permutation.

    Change

    Fail init for invalid -noconnect values, same pattern as -wallet / -nowallet: -connect must be a string host/IP -noconnect / -noconnect=1 still disable automatic connections

    Double-negatives like -noconnect=0 are stored as boolean true, which GetArgs stringifies as "1" and Lookup resolves as 0.0.0.1

    those now error instead.

  2. DrahtBot commented at 7:15 PM on August 9, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    Concept ACK jeanpablojp

    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:

    • #31260 (scripted-diff: Type-safe settings retrieval 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-->

  3. jeanpablojp commented at 11:47 PM on August 11, 2026: contributor

    Concept ACK

    Makes sense to me, better to give a clear error than to silently try to connect to 0.0.0.1.

    I believe this is missing a doc/release-notes-35939.md, since the change alters user-visible behavior.

  4. Avecci-Claussen referenced this in commit 9de79b8a5f on Aug 12, 2026
  5. Avecci-Claussen commented at 11:08 PM on August 12, 2026: none

    Thank you for reminding, added doc/release-notes-35939.md for the user-visible init change.

  6. winterrdog commented at 9:52 AM on August 14, 2026: contributor

    the commit messages are not descriptive enough for a future reader (and, in some cases, even for a current reader)

    from the contributing guide:

    Commit messages should be helpful to people reading your code in the future, so explain the reasoning for your decisions.

    therefore, a couple of things need to be addressed:

    • since this is a simple bug fix, the test commit (32cf26d) and the bug fix (2df1750) need to be combined into a single commit. see Commit structure for tests
    • the commit message needs to explain what is being fixed and why, so the reasoning is preserved for future readers
  7. Avecci-Claussen force-pushed on Aug 14, 2026
  8. Avecci-Claussen commented at 3:28 PM on August 14, 2026: none

    squashed the test into the init commit and rewrote the message to explain the -noconnect=0 → 0.0.0.1 path. Release notes stay in a separate doc commit.

    let me know if i missed anything else. Thanks a lot

  9. init: reject -noconnect=0 as -connect=1
    -noconnect=0 is stored as boolean true. GetArgs() then stringifies
    that as "1", and Lookup() treats "1" as 0.0.0.1, so the node tries
    to connect to 0.0.0.1 and applies the usual -connect side effects
    (no listen/dnsseed).
    
    Reject non-string -connect/-noconnect values at init, matching
    -wallet/-nowallet. Bare -noconnect and -noconnect=1 still disable
    automatic connections.
    
    Fixes #31426.
    78ad94a29a
  10. doc: add release notes for -noconnect init error
    Startup now fails on invalid -noconnect values instead of treating
    -noconnect=0 as a connection to 0.0.0.1.
    f2bfbddb00
  11. Avecci-Claussen force-pushed on Aug 14, 2026
  12. Avecci-Claussen requested review from winterrdog on Aug 14, 2026
  13. DrahtBot added the label CI failed on Aug 17, 2026
  14. maflcko commented at 12:38 PM on August 17, 2026: member

    From #31426 (comment):

    Given the complexity of existing behavior, it may be better to help review one of [the pre-existing PRs].

    I don't see the point of special casing each arg handling manually. There are many arg handling footguns, and fixing all of them for each arg separately isn't going to work.

    Instead of creating conflicting pull requests, it would be better to review the existing ones.

  15. Avecci-Claussen commented at 3:58 PM on August 17, 2026: none

    Thanks, that makes sense. I treated the issue as a local init check and missed that the thread already pointed at the typed-settings work instead of per-arg special cases. Closing this in favor of reviewing #31260.

  16. Avecci-Claussen closed this on Aug 17, 2026


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: 2026-08-31 19:51 UTC

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