diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2019-11-07 22:01:22 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2019-11-07 22:01:22 -0500 |
commit | dc8e1e75487461ec9bff433144f0db831b682403 (patch) | |
tree | bfbe7db40e7ab55885033e36ae20bde51695f5d9 /src/util/system.cpp | |
parent | 2fb6140d585fa05547415a6c440dc43b561e2439 (diff) |
Clarify emptyIncludeConf logic
Suggestion from John Newbery <john@johnnewbery.com> in
https://github.com/bitcoin/bitcoin/pull/15934#discussion_r343795528
Diffstat (limited to 'src/util/system.cpp')
-rw-r--r-- | src/util/system.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp index 7da408eda5..9254004191 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -894,14 +894,19 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) if (!ReadConfigStream(stream, confPath, error, ignore_invalid_keys)) { return false; } - // if there is an -includeconf in the override args, but it is empty, that means the user - // passed '-noincludeconf' on the command line, in which case we should not include anything - bool emptyIncludeConf; + // `-includeconf` cannot be included in the command line arguments except + // as `-noincludeconf` (which indicates that no conf file should be used). + bool use_conf_file{true}; { LOCK(cs_args); - emptyIncludeConf = m_override_args.count("-includeconf") == 0; + auto it = m_override_args.find("-includeconf"); + if (it != m_override_args.end()) { + // ParseParameters() fails if a non-negated -includeconf is passed on the command-line + assert(it->second.empty()); + use_conf_file = false; + } } - if (emptyIncludeConf) { + if (use_conf_file) { std::string chain_id = GetChainName(); std::vector<std::string> includeconf(GetArgs("-includeconf")); { |