diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-04-17 22:20:59 +0200 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-05-09 15:49:14 +0200 |
commit | ba8fc7d788932b25864fb260ca14983aa2398c23 (patch) | |
tree | 3049d9b5282c243faf7e0ab1e7d2a7ee17937a36 /src/util | |
parent | 401453df419af35957ec711423ac3d93ad512fe8 (diff) |
refactor: Replace string chain name constants with ChainTypes
This commit effectively moves the definition of these constants
out of the chainparamsbase to their own file.
Using the ChainType enums provides better type safety compared to
passing around strings.
The commit is part of an ongoing effort to decouple the libbitcoinkernel
library from the ArgsManager and other functionality that should not be
part of the kernel library.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/settings.cpp | 8 | ||||
-rw-r--r-- | src/util/settings.h | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/util/settings.cpp b/src/util/settings.cpp index bb257c0584..db3d60046e 100644 --- a/src/util/settings.cpp +++ b/src/util/settings.cpp @@ -130,7 +130,7 @@ SettingsValue GetSetting(const Settings& settings, const std::string& name, bool ignore_default_section_config, bool ignore_nonpersistent, - bool get_chain_name) + bool get_chain_type) { SettingsValue result; bool done = false; // Done merging any more settings sources. @@ -145,17 +145,17 @@ SettingsValue GetSetting(const Settings& settings, // assigned value instead of last. In general, later settings take // precedence over early settings, but for backwards compatibility in // the config file the precedence is reversed for all settings except - // chain name settings. + // chain type settings. const bool reverse_precedence = (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) && - !get_chain_name; + !get_chain_type; // Weird behavior preserved for backwards compatibility: Negated // -regtest and -testnet arguments which you would expect to override // values set in the configuration file are currently accepted but // silently ignored. It would be better to apply these just like other // negated values, or at least warn they are ignored. - const bool skip_negated_command_line = get_chain_name; + const bool skip_negated_command_line = get_chain_type; if (done) return; diff --git a/src/util/settings.h b/src/util/settings.h index 27e87a4751..bb1fe585e1 100644 --- a/src/util/settings.h +++ b/src/util/settings.h @@ -60,14 +60,14 @@ bool WriteSettings(const fs::path& path, //! command line). Only return settings in the //! read-only config and read-write settings //! files. -//! @param get_chain_name - enable special backwards compatible behavior -//! for GetChainName +//! @param get_chain_type - enable special backwards compatible behavior +//! for GetChainType SettingsValue GetSetting(const Settings& settings, const std::string& section, const std::string& name, bool ignore_default_section_config, bool ignore_nonpersistent, - bool get_chain_name); + bool get_chain_type); //! Get combined setting value similar to GetSetting(), except if setting was //! specified multiple times, return a list of all the values specified. |