Skip to content

Args: -noconnect=0 is interpreted as -connect=0.0.0.1 #31426

@hodlinator

Description

@hodlinator

Motivation

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

₿ build/src/bitcoind -noconnect=0 -debug=net

Produces the following output:

2024-12-05T08:20:41Z Warning: parsed potentially confusing double-negative -connect=0
2024-12-05T08:20:41Z Bitcoin Core version v28.99.0-95a0104f2e98-dirty (release build)
2024-12-05T08:20:41Z parameter interaction: -connect or -maxconnections=0 set -> setting -dnsseed=0
2024-12-05T08:20:41Z parameter interaction: -connect or -maxconnections=0 set -> setting -listen=0
2024-12-05T08:20:41Z parameter interaction: -listen=0 -> setting -natpmp=0
2024-12-05T08:20:41Z parameter interaction: -listen=0 -> setting -discover=0
2024-12-05T08:20:41Z parameter interaction: -listen=0 -> setting -listenonion=0
2024-12-05T08:20:41Z parameter interaction: -listen=0 -> setting -i2pacceptincoming=0
...
2024-12-05T08:20:44Z net thread start
2024-12-05T08:20:49Z [net] connection attempt to 0.0.0.1:8333 timed out
2024-12-05T08:20:50Z [net] trying v2 connection 1 lastseen=0.0hrs

Main issue

bitcoind should not try to connect to the 0.0.0.1 IPv4 address.

Bonus

-noconnect=0 should not result in -dnsseed=0 and -listen=0 in the parameter interaction logic.

Issue inspiration: #31212 (comment)

Possible solution

Probably best to fail the Init-stage for invalid -(no)connect(=value) permutations.

Should include a functional test verifying that there is an Init-error for this case, possibly added to test/functional/feature_config_args.py.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions