Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 7: [PATCH 07/17] feat(rpc): preserve Roots operator interfaces on v31

src/common/settings.cpp

Before: src/common/settings.cpp · After: src/common/settings.cpp

File metadata
index 7d511b574dea23f68ed029e1be1186c341790b65..288ef894aba0b0d10c4158976aecd2e51308de71 100644

Download original patch · Release notes

Diff rows 1–33 of 33. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/common/settings.cpp CHANGED
@@ -24,6 +24,7 @@ namespace {
24
24
  enum class Source {
25
25
  FORCED,
26
26
  COMMAND_LINE,
27
+ CONFIG_FILE_RW,
27
28
  RW_SETTINGS,
28
29
  CONFIG_FILE_NETWORK_SECTION,
29
30
  CONFIG_FILE_DEFAULT_SECTION
@@ -48,6 +49,10 @@ static void MergeSettings(const Settings& settings, const std::string& section,
48
49
  if (auto* values = FindKey(settings.command_line_options, name)) {
49
50
  fn(SettingsSpan(*values), Source::COMMAND_LINE);
50
51
  }
52
+ // Merge in the rw config file
53
+ if (auto* values = FindKey(settings.rw_config, name)) {
54
+ fn(SettingsSpan(*values), Source::CONFIG_FILE_RW);
55
+ }
51
56
  // Merge in the read-write settings
52
57
  if (const SettingsValue* value = FindKey(settings.rw_settings, name)) {
53
58
  fn(SettingsSpan(*value), Source::RW_SETTINGS);
@@ -173,7 +178,7 @@ SettingsValue GetSetting(const Settings& settings,
173
178
  // the config file the precedence is reversed for all settings except
174
179
  // chain type settings.
175
180
  const bool reverse_precedence =
176
- (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
181
+ (source == Source::CONFIG_FILE_RW || source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
177
182
  !get_chain_type;
178
183
 
179
184
  // Weird behavior preserved for backwards compatibility: Negated
@@ -225,7 +230,7 @@ std::vector<SettingsValue> GetSettingsList(const Settings& settings,
225
230
  // settings will be brought back from the dead (but earlier command
226
231
  // line settings will still be ignored).
227
232
  const bool add_zombie_config_values =
228
- (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
233
+ (source == Source::CONFIG_FILE_RW || source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
229
234
  !prev_negated_empty;
230
235
 
231
236
  // Ignore settings in default config section if requested.