aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-07-27 12:37:09 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-07-27 22:51:58 +0300
commitdde80c272ae584410532f48d23866d7d8581a1cc (patch)
treea2c8d160de867db18bd965b339f5b5bdffa7f3f0 /src/util/system.cpp
parent9a12733508e47f558959f1b0ed9937bc3eff8962 (diff)
Use ArgsManager::NETWORK_ONLY flag
Diffstat (limited to 'src/util/system.cpp')
-rw-r--r--src/util/system.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 75dbc72e77..b8aa168082 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -307,18 +307,7 @@ static void InterpretOption(std::string key, std::string val, std::map<std::stri
args[key].push_back(val);
}
-ArgsManager::ArgsManager() :
- /* These options would cause cross-contamination if values for
- * mainnet were used while running on regtest/testnet (or vice-versa).
- * Setting them as section_only_args ensures that sharing a config file
- * between mainnet and regtest/testnet won't cause problems due to these
- * parameters by accident. */
- m_network_only_args{
- "-addnode", "-connect",
- "-port", "-bind",
- "-rpcport", "-rpcbind",
- "-wallet",
- }
+ArgsManager::ArgsManager()
{
// nothing to do
}
@@ -546,11 +535,16 @@ void ArgsManager::AddArg(const std::string& name, const std::string& help, unsig
if (eq_index == std::string::npos) {
eq_index = name.size();
}
+ std::string arg_name = name.substr(0, eq_index);
LOCK(cs_args);
std::map<std::string, Arg>& arg_map = m_available_args[cat];
- auto ret = arg_map.emplace(name.substr(0, eq_index), Arg{name.substr(eq_index, name.size() - eq_index), help, flags});
+ auto ret = arg_map.emplace(arg_name, Arg{name.substr(eq_index, name.size() - eq_index), help, flags});
assert(ret.second); // Make sure an insertion actually happened
+
+ if (flags & ArgsManager::NETWORK_ONLY) {
+ m_network_only_args.emplace(arg_name);
+ }
}
void ArgsManager::AddHiddenArgs(const std::vector<std::string>& names)