Skip to content

Commit dddd6f0

Browse files
author
MarcoFalke
committed
init: Throw error when network specific config is ignored
1 parent 81f732b commit dddd6f0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/init.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -828,19 +828,6 @@ void InitParameterInteraction()
828828
if (gArgs.SoftSetBoolArg("-whitelistrelay", true))
829829
LogPrintf("%s: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1\n", __func__);
830830
}
831-
832-
// Warn if network-specific options (-addnode, -connect, etc) are
833-
// specified in default section of config file, but not overridden
834-
// on the command line or in this network's section of the config file.
835-
std::string network = gArgs.GetChainName();
836-
for (const auto& arg : gArgs.GetUnsuitableSectionOnlyArgs()) {
837-
InitWarning(strprintf(_("Config setting for %s only applied on %s network when in [%s] section."), arg, network, network));
838-
}
839-
840-
// Warn if unrecognized section name are present in the config file.
841-
for (const auto& section : gArgs.GetUnrecognizedSections()) {
842-
InitWarning(strprintf("%s:%i " + _("Section [%s] is not recognized."), section.m_file, section.m_line, section.m_name));
843-
}
844831
}
845832

846833
static std::string ResolveErrMsg(const char * const optname, const std::string& strBind)
@@ -950,6 +937,19 @@ bool AppInitParameterInteraction()
950937

951938
// also see: InitParameterInteraction()
952939

940+
// Warn if network-specific options (-addnode, -connect, etc) are
941+
// specified in default section of config file, but not overridden
942+
// on the command line or in this network's section of the config file.
943+
std::string network = gArgs.GetChainName();
944+
for (const auto& arg : gArgs.GetUnsuitableSectionOnlyArgs()) {
945+
return InitError(strprintf(_("Config setting for %s only applied on %s network when in [%s] section."), arg, network, network));
946+
}
947+
948+
// Warn if unrecognized section name are present in the config file.
949+
for (const auto& section : gArgs.GetUnrecognizedSections()) {
950+
InitWarning(strprintf("%s:%i " + _("Section [%s] is not recognized."), section.m_file, section.m_line, section.m_name));
951+
}
952+
953953
if (!fs::is_directory(GetBlocksDir())) {
954954
return InitError(strprintf(_("Specified blocks directory \"%s\" does not exist."), gArgs.GetArg("-blocksdir", "").c_str()));
955955
}

0 commit comments

Comments
 (0)