Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 2: [PATCH 02/68] feat(runtime): preserve Roots operator controls on Core 30.3

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. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/common/settings.cpp CHANGED
@@ -24,6 +24,7 @@ namespace {
24
  enum class Source {
25
  FORCED,
26
  COMMAND_LINE,
 
27
  RW_SETTINGS,
28
  CONFIG_FILE_NETWORK_SECTION,
29
  CONFIG_FILE_DEFAULT_SECTION
@@ -48,6 +49,10 @@ static void MergeSettings(const Settings& settings, const std::string& section,
48
  if (auto* values = FindKey(settings.command_line_options, name)) {
49
  fn(SettingsSpan(*values), Source::COMMAND_LINE);
50
  }
 
 
 
 
51
  // Merge in the read-write settings
52
  if (const SettingsValue* value = FindKey(settings.rw_settings, name)) {
53
  fn(SettingsSpan(*value), Source::RW_SETTINGS);
@@ -165,7 +170,7 @@ SettingsValue GetSetting(const Settings& settings,
165
  // the config file the precedence is reversed for all settings except
166
  // chain type settings.
167
  const bool reverse_precedence =
168
- (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
169
  !get_chain_type;
170
 
171
  // Weird behavior preserved for backwards compatibility: Negated
@@ -217,7 +222,7 @@ std::vector<SettingsValue> GetSettingsList(const Settings& settings,
217
  // settings will be brought back from the dead (but earlier command
218
  // line settings will still be ignored).
219
  const bool add_zombie_config_values =
220
- (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
221
  !prev_negated_empty;
222
 
223
  // Ignore settings in default config section if requested.
 
24
  enum class Source {
25
  FORCED,
26
  COMMAND_LINE,
27
+ CONFIG_FILE_RW,
28
  RW_SETTINGS,
29
  CONFIG_FILE_NETWORK_SECTION,
30
  CONFIG_FILE_DEFAULT_SECTION
 
49
  if (auto* values = FindKey(settings.command_line_options, name)) {
50
  fn(SettingsSpan(*values), Source::COMMAND_LINE);
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
+ }
56
  // Merge in the read-write settings
57
  if (const SettingsValue* value = FindKey(settings.rw_settings, name)) {
58
  fn(SettingsSpan(*value), Source::RW_SETTINGS);
 
170
  // the config file the precedence is reversed for all settings except
171
  // chain type settings.
172
  const bool reverse_precedence =
173
+ (source == Source::CONFIG_FILE_RW || source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
174
  !get_chain_type;
175
 
176
  // Weird behavior preserved for backwards compatibility: Negated
 
222
  // settings will be brought back from the dead (but earlier command
223
  // line settings will still be ignored).
224
  const bool add_zombie_config_values =
225
+ (source == Source::CONFIG_FILE_RW || source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
226
  !prev_negated_empty;
227
 
228
  // Ignore settings in default config section if requested.