Skip to content
Bitcoin Roots

v29.4-roots.1 · Commit 2: [PATCH 02/13] runtime: preserve shared operator controls

src/common/settings.cpp

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

File metadata
index 046afca15d7c53858472d85d4dccb2e315432a3d..17c87d63b2b7ecf9f4af3dee1345b8358af474ea 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);
@@ -165,7 +170,7 @@ SettingsValue GetSetting(const Settings& settings,
165
170
  // the config file the precedence is reversed for all settings except
166
171
  // chain type settings.
167
172
  const bool reverse_precedence =
168
- (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
173
+ (source == Source::CONFIG_FILE_RW || source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
169
174
  !get_chain_type;
170
175
 
171
176
  // Weird behavior preserved for backwards compatibility: Negated
@@ -217,7 +222,7 @@ std::vector<SettingsValue> GetSettingsList(const Settings& settings,
217
222
  // settings will be brought back from the dead (but earlier command
218
223
  // line settings will still be ignored).
219
224
  const bool add_zombie_config_values =
220
- (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
225
+ (source == Source::CONFIG_FILE_RW || source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
221
226
  !prev_negated_empty;
222
227
 
223
228
  // Ignore settings in default config section if requested.