diff --git a/src/util/system.h b/src/util/system.h --- a/src/util/system.h +++ b/src/util/system.h @@ -145,18 +145,31 @@ }; class ArgsManager { +public: + enum Flags { + NONE = 0x00, + // Boolean options can accept negation syntax -noOPTION or -noOPTION=1 + ALLOW_BOOL = 0x01, + ALLOW_INT = 0x02, + ALLOW_STRING = 0x04, + ALLOW_ANY = ALLOW_BOOL | ALLOW_INT | ALLOW_STRING, + DEBUG_ONLY = 0x100, + /* Some options would cause cross-contamination if values for + * mainnet were used while running on regtest/testnet (or vice-versa). + * Setting them as NETWORK_ONLY ensures that sharing a config file + * between mainnet and regtest/testnet won't cause problems due to these + * parameters by accident. */ + NETWORK_ONLY = 0x200, + }; + protected: friend class ArgsManagerHelper; struct Arg { std::string m_help_param; std::string m_help_text; + unsigned int m_flags; bool m_debug_only; - - Arg(const std::string &help_param, const std::string &help_text, - bool debug_only) - : m_help_param(help_param), m_help_text(help_text), - m_debug_only(debug_only){}; }; mutable CCriticalSection cs_args; diff --git a/src/util/system.cpp b/src/util/system.cpp --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -637,9 +637,10 @@ LOCK(cs_args); std::map &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, debug_only)); + auto ret = + arg_map.emplace(name.substr(0, eq_index), + Arg{name.substr(eq_index, name.size() - eq_index), help, + ArgsManager::NONE, debug_only}); // Make sure an insertion actually happened. assert(ret.second); }