mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
bugfix: Fix incorrect debug.log config file path
Currently debug.log will show the wrong bitcoin.conf config file path when bitcoind is invoked without -conf or -datadir arguments, and there's a default bitcoin.conf file which specifies another datadir= location. When this happens, the debug.log will include an incorrect "Config file:" line referring to a bitcoin.conf file in the other datadir, instead of the referring to the actual configuration file in the default datadir which was parsed. The bad log print was reported and originally fixed in https://github.com/bitcoin/bitcoin/pull/27303 by Matthew Zipkin <pinheadmz@gmail.com> This PR takes a slightly different approach to fixing the bug, trying to avoid future bugs by not allowing the GetConfigFilePath function to be called before the the configuration is parsed, and deleting GetConfigFile function which could be confused with GetConfigFilePath. It also includes a test for the bug which the original fix did not have. Co-authored-by: Matthew Zipkin <pinheadmz@gmail.com>
This commit is contained in:
parent
3746f00be1
commit
eefe56967b
6 changed files with 45 additions and 9 deletions
|
|
@ -32,7 +32,7 @@ std::optional<ConfigError> InitConfig(ArgsManager& args, SettingsAbortFn setting
|
|||
// parse error, and specifying a datadir= location containing another
|
||||
// bitcoin.conf file just ignores the other file.)
|
||||
const fs::path orig_datadir_path{args.GetDataDirBase()};
|
||||
const fs::path orig_config_path = args.GetConfigFilePath();
|
||||
const fs::path orig_config_path{AbsPathForConfigVal(args, args.GetPathArg("-conf", BITCOIN_CONF_FILENAME), /*net_specific=*/false)};
|
||||
|
||||
std::string error;
|
||||
if (!args.ReadConfigFiles(error, true)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue