Skip to content
Bitcoin Roots

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

src/common/args.h

Before: src/common/args.h · After: src/common/args.h

File metadata
index 97c32c87f7c069d3cca5b5b048e98578cb7b863c..5a6bc254e73090c2821f4f1731c0281417159f33 100644

Download original patch · Release notes

Diff rows 1–50 of 50. 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/args.h CHANGED
@@ -26,6 +26,7 @@ class ArgsManager;
26
 
27
  extern const char * const BITCOIN_CONF_FILENAME;
28
  extern const char * const BITCOIN_SETTINGS_FILENAME;
 
29
 
30
  // Return true if -datadir option points to a valid directory or is not specified.
31
  bool CheckDataDirOption(const ArgsManager& args);
@@ -66,6 +67,7 @@ enum class OptionsCategory {
66
  REGISTER_COMMANDS,
67
  CLI_COMMANDS,
68
  IPC,
 
69
 
70
  HIDDEN // Always the last option to avoid printing these in the help
71
  };
@@ -99,6 +101,8 @@ std::optional<Int> SettingTo(const common::SettingsValue&);
99
  bool SettingToBool(const common::SettingsValue&, bool);
100
  std::optional<bool> SettingToBool(const common::SettingsValue&);
101
 
 
 
102
  class ArgsManager
103
  {
104
  public:
@@ -146,11 +150,13 @@ protected:
146
  bool m_accept_any_command GUARDED_BY(cs_args){true};
147
  std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args);
148
  std::optional<fs::path> m_config_path GUARDED_BY(cs_args);
 
 
149
  mutable fs::path m_cached_blocks_path GUARDED_BY(cs_args);
150
  mutable fs::path m_cached_datadir_path GUARDED_BY(cs_args);
151
  mutable fs::path m_cached_network_datadir_path GUARDED_BY(cs_args);
152
 
153
- [[nodiscard]] bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false);
154
 
155
  /**
156
  * Returns true if settings values from the default section should be used,
@@ -189,8 +195,14 @@ protected:
189
  */
190
  fs::path GetConfigFilePath() const;
191
  void SetConfigFilePath(fs::path);
 
192
  [[nodiscard]] bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
193
 
 
 
 
 
 
194
  /**
195
  * Log warnings for options in m_section_only_args when
196
  * they are specified in the default section but not overridden
 
26
 
27
  extern const char * const BITCOIN_CONF_FILENAME;
28
  extern const char * const BITCOIN_SETTINGS_FILENAME;
29
+ extern const char * const BITCOIN_RW_CONF_FILENAME;
30
 
31
  // Return true if -datadir option points to a valid directory or is not specified.
32
  bool CheckDataDirOption(const ArgsManager& args);
 
67
  REGISTER_COMMANDS,
68
  CLI_COMMANDS,
69
  IPC,
70
+ STATS,
71
 
72
  HIDDEN // Always the last option to avoid printing these in the help
73
  };
 
101
  bool SettingToBool(const common::SettingsValue&, bool);
102
  std::optional<bool> SettingToBool(const common::SettingsValue&);
103
 
104
+ void ModifyRWConfigStream(std::istream& stream_in, std::ostream& stream_out, const std::map<std::string, std::string>& settings_to_change);
105
+
106
  class ArgsManager
107
  {
108
  public:
 
150
  bool m_accept_any_command GUARDED_BY(cs_args){true};
151
  std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args);
152
  std::optional<fs::path> m_config_path GUARDED_BY(cs_args);
153
+ std::optional<fs::path> m_rwconf_path GUARDED_BY(cs_args);
154
+ bool m_rwconf_had_prune_option GUARDED_BY(cs_args){false};
155
  mutable fs::path m_cached_blocks_path GUARDED_BY(cs_args);
156
  mutable fs::path m_cached_datadir_path GUARDED_BY(cs_args);
157
  mutable fs::path m_cached_network_datadir_path GUARDED_BY(cs_args);
158
 
159
+ [[nodiscard]] bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false, std::map<std::string, std::vector<common::SettingsValue>>* settings_target = nullptr);
160
 
161
  /**
162
  * Returns true if settings values from the default section should be used,
 
195
  */
196
  fs::path GetConfigFilePath() const;
197
  void SetConfigFilePath(fs::path);
198
+ fs::path GetRWConfigFilePath() const;
199
  [[nodiscard]] bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
200
 
201
+ bool RWConfigHasPruneOption() const { LOCK(cs_args); return m_rwconf_had_prune_option; }
202
+ void ModifyRWConfigFile(const std::map<std::string, std::string>& settings_to_change, bool also_settings_json = true);
203
+ void ModifyRWConfigFile(const std::string& setting_to_change, const std::string& new_value, bool also_settings_json = true);
204
+ void EraseRWConfigFile();
205
+
206
  /**
207
  * Log warnings for options in m_section_only_args when
208
  * they are specified in the default section but not overridden