mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 22:24:05 +01:00
Add loadwallet and createwallet RPC load_on_startup options
This maintains a persistent list of wallets stored in settings that will automatically be loaded on startup. Being able to load a wallet automatically on startup will be more useful in the GUI when the option to create wallets is added in #15006, but it's reasonable to expose this feature by RPC as well.
This commit is contained in:
@@ -372,6 +372,27 @@ public:
|
||||
RPCRunLater(name, std::move(fn), seconds);
|
||||
}
|
||||
int rpcSerializationFlags() override { return RPCSerializationFlags(); }
|
||||
util::SettingsValue getRwSetting(const std::string& name) override
|
||||
{
|
||||
util::SettingsValue result;
|
||||
gArgs.LockSettings([&](const util::Settings& settings) {
|
||||
if (const util::SettingsValue* value = util::FindKey(settings.rw_settings, name)) {
|
||||
result = *value;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
bool updateRwSetting(const std::string& name, const util::SettingsValue& value) override
|
||||
{
|
||||
gArgs.LockSettings([&](util::Settings& settings) {
|
||||
if (value.isNull()) {
|
||||
settings.rw_settings.erase(name);
|
||||
} else {
|
||||
settings.rw_settings[name] = value;
|
||||
}
|
||||
});
|
||||
return gArgs.WriteSettingsFile();
|
||||
}
|
||||
void requestMempoolTransactions(Notifications& notifications) override
|
||||
{
|
||||
LOCK2(::cs_main, ::mempool.cs);
|
||||
|
||||
Reference in New Issue
Block a user