-
Notifications
You must be signed in to change notification settings - Fork 37.8k
More verbose warning for multiple network argument error. #26028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
What about just modifying the error string to encourage the user to re-check the command line and config file? |
5b4f6c7
to
4b0de90
Compare
Hi @MarcoFalke, Well that would be simpler for sure. I am open to that if you think it is a good idea. Perhaps I went overboard. I can modify that string, ditch the feature test and make sure the unit test still works. I'm trying to get past this listing error on python -utf8. If you have any insights that would be appreciated. |
8ed8ac3
to
a73caa9
Compare
@MarcoFalke I made your suggested changes, doesn't need the additional functional test. LInting error solved. |
src/util/system.cpp
Outdated
@@ -1061,7 +1061,7 @@ std::string ArgsManager::GetChainName() const | |||
LOCK(cs_args); | |||
util::SettingsValue value = util::GetSetting(m_settings, /* section= */ "", SettingName(arg), | |||
/* ignore_default_section_config= */ false, | |||
/*ignore_nonpersistent=*/false, | |||
/* ignore_nonpersistent= */ false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this, and the rest of the unrelated code changes.
src/util/system.cpp
Outdated
} | ||
if (fRegTest) | ||
return CBaseChainParams::REGTEST; | ||
if (fSigNet) { | ||
if (fSigNet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a regression in coding style. If you want to update these, they should probably all be one liners.
eg
if (fSigNet) | |
if (fSigNet) return CBaseChainParams::SIGNET; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @luke-jr @MarcoFalke
I'm not sure the protocol for submitting suggested changes. I'm squashing the commit down. Or would it be better to have the suggested changes into a separate commit for better transparency for future reviewers?
a73caa9
to
17df428
Compare
17df428
to
90f5c53
Compare
As small of a change this was, and as difficult as it was I'm super happy to have this approved. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
@@ -1072,16 +1072,11 @@ std::string ArgsManager::GetChainName() const | |||
const bool is_chain_arg_set = IsArgSet("-chain"); | |||
|
|||
if ((int)is_chain_arg_set + (int)fRegTest + (int)fSigNet + (int)fTestNet > 1) { | |||
throw std::runtime_error("Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one."); | |||
throw std::runtime_error("Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one. Please check if chain is specified in config file."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw std::runtime_error("Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one. Please check if chain is specified in config file."); | |
throw std::runtime_error("Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one. Please check your config options on the command line and in the bitcoin.conf file."); |
Yes, in this project it's generally preferred to squash the changes, if needed, into their final form. See |
🐙 This pull request conflicts with the target branch and needs rebase. |
@amovfx are you going to follow up here? This is not currently mergable. |
Closing for now due to lack of activity. Let us know when the should be reopened. |
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:
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.
In this PR, if a user makes this error, they will be notified to check their conf files.
The new error is a bit more verbose for the command bitcoind -regtest if the chain argument is set in the command line.
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
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.