aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2016-09-09 08:50:09 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2017-06-06 21:17:09 +0000
commit0f08575be2c6016c2c920e2b5b994e467576857d (patch)
tree2550988b0afa0379b0c493eb73bb0c1be7438935 /src/wallet
parentb124cf04ea47e1eda60bbc26a9690a9715c6b23f (diff)
Wallet: Support loading multiple wallets if -wallet used more than once
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index e5c9f11aa6..241aaffcef 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3930,19 +3930,21 @@ bool CWallet::InitLoadWallet()
return true;
}
- std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
+ SoftSetArg("-wallet", DEFAULT_WALLET_DAT);
- if (boost::filesystem::path(walletFile).filename() != walletFile) {
- return InitError(_("-wallet parameter must only specify a filename (not a path)"));
- } else if (SanitizeString(walletFile, SAFE_CHARS_FILENAME) != walletFile) {
- return InitError(_("Invalid characters in -wallet filename"));
- }
+ for (const std::string& walletFile : gArgs.GetArgs("-wallet")) {
+ if (boost::filesystem::path(walletFile).filename() != walletFile) {
+ return InitError(_("-wallet parameter must only specify a filename (not a path)"));
+ } else if (SanitizeString(walletFile, SAFE_CHARS_FILENAME) != walletFile) {
+ return InitError(_("Invalid characters in -wallet filename"));
+ }
- CWallet * const pwallet = CreateWalletFromFile(walletFile);
- if (!pwallet) {
- return false;
+ CWallet * const pwallet = CreateWalletFromFile(walletFile);
+ if (!pwallet) {
+ return false;
+ }
+ vpwallets.push_back(pwallet);
}
- vpwallets.push_back(pwallet);
return true;
}