Int command line settings silently fail to be used in a bool context #23062

issue maflcko openend this issue on September 22, 2021
  1. maflcko commented at 10:01 am on September 22, 2021: member

    Command line args to set int values can’t easily be used in a bool context. In fact, they will silently do the wrong thing.

    For example, setting -checkaddrman will silently disable the checks, instead of enabling them.

    Obviously reading the documentation would avoid those mishaps, but it still feels wrong to silently do the opposite thing the user asked for.

    Same for: -mempoolexpiry, -par, and pretty much any other int setting that can be mistaken as a bool setting.

  2. maflcko added the label Utils/log/libs on Sep 22, 2021
  3. ryanofsky commented at 1:13 pm on September 22, 2021: contributor

    Few thoughts:

    • I think it’s good to only change the way options are interpreted in targeted PRs like #23061, and in general be as careful as possible changing what any existing option does.

    • Changes in how options are interpreted should be well documented:

      • At minimum, I think PRs changing this should have release notes saying “Option -X previously did Y, starting from this release the new behavior is Z.”
      • Ideally, I think these changes be a part of man and -help documentation, even though we don’t have a precedent for doing this. I think ideally help should look like “-flag: <description of flag>. Behavior of this option changed in version V. Previously X did Y instead of Z.” The information about previous versions could be removed after those versions are no longer supported.
    • If any options can have a big impact on security or privacy or performance, it would be better to avoid changing their behavior at all, and instead just add new options to replace them. This could be done with errors “Option -X has been removed. Please use option -Y instead” or warnings “Option -X is deprecated, please use option -Y instead”

    • In #16545, with the ALLOW_INT flag, this problem would not happen. The ambiguous syntax would trigger “Can not set -xxx with no value. It must be set to an integer” errors

  4. willcl-ark removed the label Utils/log/libs on Oct 16, 2025
  5. willcl-ark added the label Settings on Oct 16, 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-10-31 18:13 UTC

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