Chain Argument collision warning #26027

pull amovfx wants to merge 35 commits into bitcoin:master from amovfx:argument-collision-warning changing 4 files +123 −15
  1. amovfx commented at 11:06 PM on September 6, 2022: none

    This PR has bitcoin print a more verbose message when a network argument collisions happens. I'm new to using the bitcoin software and was reconfiguring an old node. I also have limited experience at coding, this is my first PR on an open-source project, so any feedback on how to improve this process is welcomed.

    If a chain argument is in the bitcoin.conf and then a bitcoin command has a network flag or a chain argument, such as : bitcoind -regtest currently you are presented with the message:

    "Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one."
    

    As I am a new to this software, with not knowing that the bitcoin.conf was being merge in the command line, I was at a loss until I got guidance in the bitcoin-core-dev irc.

    This PR adds a more verbose error by splitting out "IsArgSet" in system.cpp::ArgsManager::GetChainName() into a new function that can check if chain is set in the config(persistently) and/or the command line(non persistently). In the future, if a user makes this error, they will be notified of where the collision is happening. This isn't by any means a significant improvement to the software, but from the perspective of a new user, it would have been quite helpful.

    The new error is a bit more verbose for the command bitcoind -regtest if the chain argument is set in the command line.

    "Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one. Chain argument is being set in a config file and by network arguments in the commandline."
    

    In regards to the unit test util_tests/util_ChainMerge:

    I had to write a script to check if the resulting output of master branch was the same output as the test from my branch and then update the hash accordingly. It is a simple compare of two txt files.

    You can download the scripts here: https://github.com/amovfx/btc-argument-collision-warning.git

    The functional tests I was wondering if they should just be respectively moved to interface_bitcoin_cli.py and feature_config_args.py instead of a separate file feature_chain_args_collision.py.

    I understand that your time is valuable and this isn't a significant change but I thought it was something within my ability I could contribute. Thank you for your time. Also, thanks to everyone that helped me get to this point to even submit a PR. Jonas at chain code, the blockchains commons project, programming bitcoin by Jimmy Song, Achow101's twitch stream, the many hosts of the bitcoin-pr-review club and the devs in the bitcoin-core-dev and bitcoin stack exchange answering my questions.

  2. extended ArgsManager::GetChainName
    checks if chain arg is in persistent settings or in commandline.
    added place.
    Added place holder for test_chain_arg_collisions.
    31c64036a4
  3. test chain arguments 2a930b7b85
  4. revert additional test for chain argument collision db18687853
  5. Fixing grammar in error message. 68ed852441
  6. removing newlines that interfere in util_tests/util_ChainMerge ce25caaa89
  7. Changed hash after verifying results ef093f9e8e
  8. - fixed miscalculating chain_arg_threshold in
    system.cpp
    - added feature_chain_arg_collision.py for testing
    network argument collisions
    - added feature_chain_arg_collision.py to test_runner.py
    22277ccfb0
  9. added match argument for expected_msg on
    assert_start_rases_init_error to clean up code.
    08132d7a16
  10. removed kwarg assignment for consistency e7b365792e
  11. chmod 755 168d959406
  12. extended ArgsManager::GetChainName
    checks if chain arg is in persistent settings or in commandline.
    added place.
    Added place holder for test_chain_arg_collisions.
    a8c7c49bb9
  13. test chain arguments c1bc121d15
  14. revert additional test for chain argument collision 7815895993
  15. Fixing grammar in error message. befcfc28ea
  16. removing newlines that interfere in util_tests/util_ChainMerge 2c8f6d6b6f
  17. Changed hash after verifying results bbf671d510
  18. - fixed miscalculating chain_arg_threshold in
    system.cpp
    - added feature_chain_arg_collision.py for testing
    network argument collisions
    - added feature_chain_arg_collision.py to test_runner.py
    279d736a90
  19. added match argument for expected_msg on
    assert_start_rases_init_error to clean up code.
    67b8506530
  20. removed kwarg assignment for consistency 375341ea7d
  21. chmod 755 d51dbd8b1c
  22. Merge branch 'argument-collision-warning' of https://github.com/amovfx/bitcoin into argument-collision-warning d31b0549a7
  23. linting errors b132e5ee11
  24. amovfx marked this as a draft on Sep 7, 2022
  25. Added a more verbose warning to
    ArgsManager::GetChainName for multiple network arguments colliding
    from .conf files and commandline arguments.
    c356943007
  26. Merge branch 'argument-collision-warning' of https://github.com/amovfx/bitcoin into argument-collision-warning 8544290022
  27. reverting .gitignore 967ad98dd3
  28. Added a more verbose warning for ArgsManager::GetChainName when multiple network arguments collide from .conf files and/or commandline. 8e0e5a78f3
  29. Merge branch 'argument-collision-warning' of https://github.com/amovfx/bitcoin into argument-collision-warning 3dc1cb2b34
  30. white space removal 523b205f43
  31. More verbose warning in ArgsManager::GetChainName when multiple network arguments collide from .conf and/or the commandline. 5babe84f16
  32. Merge branch 'argument-collision-warning' of https://github.com/amovfx/bitcoin into argument-collision-warning 1f1a8991e3
  33. parent 5babe84f1680ac723eed281eb9b88fe9db2cd396
    author amovfx <45839100+amovfx@users.noreply.github.com> 1662514994 -0700
    committer amovfx <45839100+amovfx@users.noreply.github.com> 1662516122 -0700
    
    parent 5babe84f1680ac723eed281eb9b88fe9db2cd396
    author amovfx <45839100+amovfx@users.noreply.github.com> 1662514994 -0700
    committer amovfx <45839100+amovfx@users.noreply.github.com> 1662516088 -0700
    
    parent 5babe84f1680ac723eed281eb9b88fe9db2cd396
    author amovfx <45839100+amovfx@users.noreply.github.com> 1662514994 -0700
    committer amovfx <45839100+amovfx@users.noreply.github.com> 1662515957 -0700
    
    parent 5babe84f1680ac723eed281eb9b88fe9db2cd396
    author amovfx <45839100+amovfx@users.noreply.github.com> 1662514994 -0700
    committer amovfx <45839100+amovfx@users.noreply.github.com> 1662515898 -0700
    
    Added a more verbose warning for ArgsManager::GetChainName when multiple network arguments collide from .conf files and/or commandline.
    
    Added a more verbose warning to
    ArgsManager::GetChainName for multiple network arguments colliding
    from .conf files and commandline arguments.
    
    extended ArgsManager::GetChainName
    checks if chain arg is in persistent settings or in commandline.
    added place.
    Added place holder for test_chain_arg_collisions.
    
    revert additional test for chain argument collision
    
    Changed hash after verifying results
    
    added match argument for expected_msg on
    assert_start_rases_init_error to clean up code.
    
    removed kwarg assignment for consistency
    
    chmod 755
    
    extended ArgsManager::GetChainName
    checks if chain arg is in persistent settings or in commandline.
    added place.
    Added place holder for test_chain_arg_collisions.
    
    revert additional test for chain argument collision
    
    Changed hash after verifying results
    
    added match argument for expected_msg on
    assert_start_rases_init_error to clean up code.
    
    removed kwarg assignment for consistency
    
    chmod 755
    
    linting errors
    
    reverting .gitignore
    
    white space removal
    b8936b46dd
  34. Merge branch 'argument-collision-warning' of https://github.com/amovfx/bitcoin into argument-collision-warning 6b80bfa04b
  35. fixed spacing c8e7b26c76
  36. Added a more verbose warning to
    ArgsManager::GetChainName for multiple network arguments colliding
    from .conf files and commandline arguments.
    b0e998a75a
  37. Merge branch 'argument-collision-warning' of https://github.com/amovfx/bitcoin into argument-collision-warning da2c8bacfb
  38. fanquake commented at 7:29 AM on September 7, 2022: member

    Closing given this is a copy of #26028.

  39. fanquake closed this on Sep 7, 2022

  40. fanquake locked this on Sep 7, 2022
Contributors

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-05-02 12:13 UTC

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