diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2019-05-01 15:12:44 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2020-08-13 09:44:48 -0400 |
commit | 642ad31b418bbf8da06cb3641329b0810e18e55b (patch) | |
tree | ef5b18d395f7766112a330c7e126703e20bb9a27 /src/wallet/init.cpp | |
parent | b4d0366b47dd9b8fe29cc9a100dcdf6ca1d3cabf (diff) |
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.
Diffstat (limited to 'src/wallet/init.cpp')
-rw-r--r-- | src/wallet/init.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 52162ab521..4c1fe57c66 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -9,6 +9,7 @@ #include <node/context.h> #include <node/ui_interface.h> #include <outputtype.h> +#include <univalue.h> #include <util/check.h> #include <util/moneystr.h> #include <util/system.h> @@ -118,6 +119,14 @@ void WalletInit::Construct(NodeContext& node) const LogPrintf("Wallet disabled!\n"); return; } - args.SoftSetArg("-wallet", ""); + // If there's no -wallet setting with a list of wallets to load, set it to + // load the default "" wallet. + if (!args.IsArgSet("wallet")) { + args.LockSettings([&](util::Settings& settings) { + util::SettingsValue wallets(util::SettingsValue::VARR); + wallets.push_back(""); // Default wallet name is "" + settings.rw_settings["wallet"] = wallets; + }); + } node.chain_clients.emplace_back(interfaces::MakeWalletClient(*node.chain, args, args.GetArgs("-wallet"))); } |