mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
chain: dont check for null settings value in overwriteRwSetting
- Just call updateRwSetting it will erase the settings when the new value is null.
This commit is contained in:
parent
df601993f2
commit
f8d91f49c7
2 changed files with 3 additions and 1 deletions
|
@ -363,6 +363,9 @@ public:
|
||||||
virtual bool updateRwSetting(const std::string& name, const SettingsUpdate& update_function) = 0;
|
virtual bool updateRwSetting(const std::string& name, const SettingsUpdate& update_function) = 0;
|
||||||
|
|
||||||
//! Replace a setting in <datadir>/settings.json with a new value.
|
//! Replace a setting in <datadir>/settings.json with a new value.
|
||||||
|
//! Null can be passed to erase the setting.
|
||||||
|
//! This method provides a simpler alternative to updateRwSetting when
|
||||||
|
//! atomically reading and updating the setting is not required.
|
||||||
virtual bool overwriteRwSetting(const std::string& name, common::SettingsValue value, SettingsAction action = SettingsAction::WRITE) = 0;
|
virtual bool overwriteRwSetting(const std::string& name, common::SettingsValue value, SettingsAction action = SettingsAction::WRITE) = 0;
|
||||||
|
|
||||||
//! Delete a given setting in <datadir>/settings.json.
|
//! Delete a given setting in <datadir>/settings.json.
|
||||||
|
|
|
@ -834,7 +834,6 @@ public:
|
||||||
}
|
}
|
||||||
bool overwriteRwSetting(const std::string& name, common::SettingsValue value, interfaces::SettingsAction action) override
|
bool overwriteRwSetting(const std::string& name, common::SettingsValue value, interfaces::SettingsAction action) override
|
||||||
{
|
{
|
||||||
if (value.isNull()) return deleteRwSettings(name, action);
|
|
||||||
return updateRwSetting(name, [&](common::SettingsValue& settings) {
|
return updateRwSetting(name, [&](common::SettingsValue& settings) {
|
||||||
settings = std::move(value);
|
settings = std::move(value);
|
||||||
return action;
|
return action;
|
||||||
|
|
Loading…
Add table
Reference in a new issue