aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/load.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-08-17 15:21:50 -0400
committerAndrew Chow <achow101-github@achow101.com>2020-09-01 12:13:50 -0400
commitf1ee37319a7a211e5fb325406d62db5b61dbd30e (patch)
treec2d5552423172f378ce6c3b8fd34ace41404f0b9 /src/wallet/load.cpp
parent89a8299a14af68c1f96ca1650cbfd4fc2952e77b (diff)
downloadbitcoin-f1ee37319a7a211e5fb325406d62db5b61dbd30e.tar.xz
wallet: Reload previously loaded wallets on GUI startup
Enable the GUI to also use the load_on_startup feature. Wallets loaded in the GUI always have load_on_startup=true. When they are unloaded from the GUI, load_on_startup=false. To facilitate this change, UpdateWalletSetting is moved into the wallet module and called from within LoadWallet, RemoveWallet, and Createwallet. This change does not actually touch the GUI code but rather the wallet functions that are shared between the GUI and RPC.
Diffstat (limited to 'src/wallet/load.cpp')
-rw-r--r--src/wallet/load.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp
index ae14769edb..5bbc8b91f7 100644
--- a/src/wallet/load.cpp
+++ b/src/wallet/load.cpp
@@ -118,30 +118,8 @@ void UnloadWallets()
while (!wallets.empty()) {
auto wallet = wallets.back();
wallets.pop_back();
- RemoveWallet(wallet);
+ std::vector<bilingual_str> warnings;
+ RemoveWallet(wallet, nullopt, warnings);
UnloadWallet(std::move(wallet));
}
}
-
-bool AddWalletSetting(interfaces::Chain& chain, const std::string& wallet_name)
-{
- util::SettingsValue setting_value = chain.getRwSetting("wallet");
- if (!setting_value.isArray()) setting_value.setArray();
- for (const util::SettingsValue& value : setting_value.getValues()) {
- if (value.isStr() && value.get_str() == wallet_name) return true;
- }
- setting_value.push_back(wallet_name);
- return chain.updateRwSetting("wallet", setting_value);
-}
-
-bool RemoveWalletSetting(interfaces::Chain& chain, const std::string& wallet_name)
-{
- util::SettingsValue setting_value = chain.getRwSetting("wallet");
- if (!setting_value.isArray()) return true;
- util::SettingsValue new_value(util::SettingsValue::VARR);
- for (const util::SettingsValue& value : setting_value.getValues()) {
- if (!value.isStr() || value.get_str() != wallet_name) new_value.push_back(value);
- }
- if (new_value.size() == setting_value.size()) return true;
- return chain.updateRwSetting("wallet", new_value);
-}