mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 21:59:10 +02:00
Merge #13799: Ignore unknown config file options; warn instead of error
247d5740d2Ignore unknown config file options for now (Pieter Wuille)04ce0d88caReport when unknown config file options are ignored (Pieter Wuille) Pull request description: As reported by @satwo on IRC a few days ago, the current mechanism of treating unknown config file options as errors is problematic for options like `-rpcclienttimeout` which aren't defined for `bitcoind`. A full solution would be to either make all binaries be aware of each other's options, or to permit config file options that only apply to specific binaries (`bitcoind`, `bitcoin-qt`, `bitcoin-cli`). Both of these seem too invasive to introduce for 0.17. As a compromise, this PR makes it ignores those options, but still warn about it in the log file. Tree-SHA512: dfddc771b91df3031a9c98d9f3292f8f4fcd1b97ebb7317b2f457e12d9f205dc63f42721302e7258dbb53f273d7cc041a65a0a9120972769555784e1f1cc9aef
This commit is contained in:
@@ -96,7 +96,7 @@ static bool AppInit(int argc, char* argv[])
|
||||
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str());
|
||||
return false;
|
||||
}
|
||||
if (!gArgs.ReadConfigFiles(error)) {
|
||||
if (!gArgs.ReadConfigFiles(error, true)) {
|
||||
fprintf(stderr, "Error reading configuration file: %s\n", error.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class NodeImpl : public Node
|
||||
{
|
||||
return gArgs.ParseParameters(argc, argv, error);
|
||||
}
|
||||
bool readConfigFiles(std::string& error) override { return gArgs.ReadConfigFiles(error); }
|
||||
bool readConfigFiles(std::string& error) override { return gArgs.ReadConfigFiles(error, true); }
|
||||
bool softSetArg(const std::string& arg, const std::string& value) override { return gArgs.SoftSetArg(arg, value); }
|
||||
bool softSetBoolArg(const std::string& arg, bool value) override { return gArgs.SoftSetBoolArg(arg, value); }
|
||||
void selectParams(const std::string& network) override { SelectParams(network); }
|
||||
|
||||
10
src/util.cpp
10
src/util.cpp
@@ -859,9 +859,13 @@ bool ArgsManager::ReadConfigStream(std::istream& stream, std::string& error, boo
|
||||
}
|
||||
|
||||
// Check that the arg is known
|
||||
if (!IsArgKnown(strKey) && !ignore_invalid_keys) {
|
||||
error = strprintf("Invalid configuration value %s", option.first.c_str());
|
||||
return false;
|
||||
if (!IsArgKnown(strKey)) {
|
||||
if (!ignore_invalid_keys) {
|
||||
error = strprintf("Invalid configuration value %s", option.first.c_str());
|
||||
return false;
|
||||
} else {
|
||||
LogPrintf("Ignoring unknown configuration value %s\n", option.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user