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.