mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Warn unrecognized sections in the config file
In the config file, sections are specified by square bracket pair "[]"$, or included in the option name itself which separated by a period"(.)". Typicaly, [testnet] is not a correct section name and specified options in that section are ignored but user cannot recognize what is happen. So, add some log/stderr-warning messages if unrecognized section names are present in the config file after checking section only args.
This commit is contained in:
10
src/init.cpp
10
src/init.cpp
@@ -803,7 +803,15 @@ void InitParameterInteraction()
|
||||
// Warn if network-specific options (-addnode, -connect, etc) are
|
||||
// specified in default section of config file, but not overridden
|
||||
// on the command line or in this network's section of the config file.
|
||||
gArgs.WarnForSectionOnlyArgs();
|
||||
std::string network = gArgs.GetChainName();
|
||||
for (const auto& arg : gArgs.GetUnsuitableSectionOnlyArgs()) {
|
||||
InitWarning(strprintf(_("Config setting for %s only applied on %s network when in [%s] section."), arg, network, network));
|
||||
}
|
||||
|
||||
// Warn if unrecognized section name are present in the config file.
|
||||
for (const auto& section : gArgs.GetUnrecognizedSections()) {
|
||||
InitWarning(strprintf(_("Section [%s] is not recognized."), section));
|
||||
}
|
||||
}
|
||||
|
||||
static std::string ResolveErrMsg(const char * const optname, const std::string& strBind)
|
||||
|
||||
Reference in New Issue
Block a user