@@ -62,29 +62,36 @@ std::optional<ConfigError> InitConfig(ArgsManager& args, SettingsAbortFn setting
62
62
fs::create_directories (net_path / " wallets" );
63
63
}
64
64
65
- // Show an error or warning if there is a bitcoin.conf file in the
65
+ // Show an error or warn/log if there is a bitcoin.conf file in the
66
66
// datadir that is being ignored.
67
67
const fs::path base_config_path = base_path / BITCOIN_CONF_FILENAME;
68
- if (fs::exists (base_config_path) && !fs::equivalent (orig_config_path, base_config_path)) {
69
- const std::string cli_config_path = args.GetArg (" -conf" , " " );
70
- const std::string config_source = cli_config_path.empty ()
71
- ? strprintf (" data directory %s" , fs::quoted (fs::PathToString (orig_datadir_path)))
72
- : strprintf (" command line argument %s" , fs::quoted (" -conf=" + cli_config_path));
73
- const std::string error = strprintf (
74
- " Data directory %1$s contains a %2$s file which is ignored, because a different configuration file "
75
- " %3$s from %4$s is being used instead. Possible ways to address this would be to:\n "
76
- " - Delete or rename the %2$s file in data directory %1$s.\n "
77
- " - Change datadir= or conf= options to specify one configuration file, not two, and use "
78
- " includeconf= to include any other configuration files.\n "
79
- " - Set allowignoredconf=1 option to treat this condition as a warning, not an error." ,
80
- fs::quoted (fs::PathToString (base_path)),
81
- fs::quoted (BITCOIN_CONF_FILENAME),
82
- fs::quoted (fs::PathToString (orig_config_path)),
83
- config_source);
84
- if (args.GetBoolArg (" -allowignoredconf" , false )) {
85
- LogPrintf (" Warning: %s\n " , error);
86
- } else {
87
- return ConfigError{ConfigStatus::FAILED, Untranslated (error)};
68
+ if (fs::exists (base_config_path)) {
69
+ if (orig_config_path.empty ()) {
70
+ LogInfo (
71
+ " Data directory %s contains a %s file which is explicitly ignored using -noconf." ,
72
+ fs::quoted (fs::PathToString (base_path)),
73
+ fs::quoted (BITCOIN_CONF_FILENAME));
74
+ } else if (!fs::equivalent (orig_config_path, base_config_path)) {
75
+ const std::string cli_config_path = args.GetArg (" -conf" , " " );
76
+ const std::string config_source = cli_config_path.empty ()
77
+ ? strprintf (" data directory %s" , fs::quoted (fs::PathToString (orig_datadir_path)))
78
+ : strprintf (" command line argument %s" , fs::quoted (" -conf=" + cli_config_path));
79
+ std::string error = strprintf (
80
+ " Data directory %1$s contains a %2$s file which is ignored, because a different configuration file "
81
+ " %3$s from %4$s is being used instead. Possible ways to address this would be to:\n "
82
+ " - Delete or rename the %2$s file in data directory %1$s.\n "
83
+ " - Change datadir= or conf= options to specify one configuration file, not two, and use "
84
+ " includeconf= to include any other configuration files." ,
85
+ fs::quoted (fs::PathToString (base_path)),
86
+ fs::quoted (BITCOIN_CONF_FILENAME),
87
+ fs::quoted (fs::PathToString (orig_config_path)),
88
+ config_source);
89
+ if (args.GetBoolArg (" -allowignoredconf" , false )) {
90
+ LogWarning (" %s" , error);
91
+ } else {
92
+ error += " \n - Set allowignoredconf=1 option to treat this condition as a warning, not an error." ;
93
+ return ConfigError{ConfigStatus::FAILED, Untranslated (error)};
94
+ }
88
95
}
89
96
}
90
97
0 commit comments