mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 15:20:49 +01:00
chain: simplify deleteRwSettings
code and improve it's doc
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
parent
f8d91f49c7
commit
8466329127
2 changed files with 3 additions and 4 deletions
|
@ -369,6 +369,8 @@ public:
|
||||||
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.
|
||||||
|
//! This method provides a simpler alternative to overwriteRwSetting when
|
||||||
|
//! erasing a setting, for ease of use and readability.
|
||||||
virtual bool deleteRwSettings(const std::string& name, SettingsAction action = SettingsAction::WRITE) = 0;
|
virtual bool deleteRwSettings(const std::string& name, SettingsAction action = SettingsAction::WRITE) = 0;
|
||||||
|
|
||||||
//! Synchronously send transactionAddedToMempool notifications about all
|
//! Synchronously send transactionAddedToMempool notifications about all
|
||||||
|
|
|
@ -841,10 +841,7 @@ public:
|
||||||
}
|
}
|
||||||
bool deleteRwSettings(const std::string& name, interfaces::SettingsAction action) override
|
bool deleteRwSettings(const std::string& name, interfaces::SettingsAction action) override
|
||||||
{
|
{
|
||||||
args().LockSettings([&](common::Settings& settings) {
|
return overwriteRwSetting(name, {}, action);
|
||||||
settings.rw_settings.erase(name);
|
|
||||||
});
|
|
||||||
return action != interfaces::SettingsAction::WRITE || args().WriteSettingsFile();
|
|
||||||
}
|
}
|
||||||
void requestMempoolTransactions(Notifications& notifications) override
|
void requestMempoolTransactions(Notifications& notifications) override
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue