Skip to content

Commit f8d91f4

Browse files
committed
chain: dont check for null settings value in overwriteRwSetting
- Just call updateRwSetting it will erase the settings when the new value is null.
1 parent df60199 commit f8d91f4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/interfaces/chain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ class Chain
363363
virtual bool updateRwSetting(const std::string& name, const SettingsUpdate& update_function) = 0;
364364

365365
//! Replace a setting in <datadir>/settings.json with a new value.
366+
//! Null can be passed to erase the setting.
367+
//! This method provides a simpler alternative to updateRwSetting when
368+
//! atomically reading and updating the setting is not required.
366369
virtual bool overwriteRwSetting(const std::string& name, common::SettingsValue value, SettingsAction action = SettingsAction::WRITE) = 0;
367370

368371
//! Delete a given setting in <datadir>/settings.json.

src/node/interfaces.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ class ChainImpl : public Chain
834834
}
835835
bool overwriteRwSetting(const std::string& name, common::SettingsValue value, interfaces::SettingsAction action) override
836836
{
837-
if (value.isNull()) return deleteRwSettings(name, action);
838837
return updateRwSetting(name, [&](common::SettingsValue& settings) {
839838
settings = std::move(value);
840839
return action;

0 commit comments

Comments
 (0)