diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2019-04-28 19:08:26 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2020-07-11 05:41:12 -0400 |
commit | 9c69cfe4c54e38edd2f54303be2f8a53dcf5bad8 (patch) | |
tree | 3480cdc4b02a6c893b0f756b8a31319351dc6b2c /src/util/settings.cpp | |
parent | eb682c5700e7a9176d0104d470b83ff9aa3589e8 (diff) |
Add <datadir>/settings.json persistent settings storage.
Persistent settings are used in followup PRs #15936 to unify gui settings
between bitcoin-qt and bitcoind, and #15937 to add a load_on_startup flag to
the loadwallet RPC and maintain a dynamic list of wallets that should be loaded
on startup that also can be shared between bitcoind and bitcoin-qt.
Diffstat (limited to 'src/util/settings.cpp')
-rw-r--r-- | src/util/settings.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/settings.cpp b/src/util/settings.cpp index 34894e994e..b92b1d30c3 100644 --- a/src/util/settings.cpp +++ b/src/util/settings.cpp @@ -13,12 +13,13 @@ namespace { enum class Source { FORCED, COMMAND_LINE, + RW_SETTINGS, CONFIG_FILE_NETWORK_SECTION, CONFIG_FILE_DEFAULT_SECTION }; //! Merge settings from multiple sources in precedence order: -//! Forced config > command line > config file network-specific section > config file default section +//! Forced config > command line > read-write settings file > config file network-specific section > config file default section //! //! This function is provided with a callback function fn that contains //! specific logic for how to merge the sources. @@ -33,6 +34,10 @@ static void MergeSettings(const Settings& settings, const std::string& section, if (auto* values = FindKey(settings.command_line_options, name)) { fn(SettingsSpan(*values), Source::COMMAND_LINE); } + // Merge in the read-write settings + if (const SettingsValue* value = FindKey(settings.rw_settings, name)) { + fn(SettingsSpan(*value), Source::RW_SETTINGS); + } // Merge in the network-specific section of the config file if (!section.empty()) { if (auto* map = FindKey(settings.ro_config, section)) { |