Skip to content

Commit 0f08575

Browse files
committed
Wallet: Support loading multiple wallets if -wallet used more than once
1 parent b124cf0 commit 0f08575

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/wallet/wallet.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3930,19 +3930,21 @@ bool CWallet::InitLoadWallet()
39303930
return true;
39313931
}
39323932

3933-
std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
3933+
SoftSetArg("-wallet", DEFAULT_WALLET_DAT);
39343934

3935-
if (boost::filesystem::path(walletFile).filename() != walletFile) {
3936-
return InitError(_("-wallet parameter must only specify a filename (not a path)"));
3937-
} else if (SanitizeString(walletFile, SAFE_CHARS_FILENAME) != walletFile) {
3938-
return InitError(_("Invalid characters in -wallet filename"));
3939-
}
3935+
for (const std::string& walletFile : gArgs.GetArgs("-wallet")) {
3936+
if (boost::filesystem::path(walletFile).filename() != walletFile) {
3937+
return InitError(_("-wallet parameter must only specify a filename (not a path)"));
3938+
} else if (SanitizeString(walletFile, SAFE_CHARS_FILENAME) != walletFile) {
3939+
return InitError(_("Invalid characters in -wallet filename"));
3940+
}
39403941

3941-
CWallet * const pwallet = CreateWalletFromFile(walletFile);
3942-
if (!pwallet) {
3943-
return false;
3942+
CWallet * const pwallet = CreateWalletFromFile(walletFile);
3943+
if (!pwallet) {
3944+
return false;
3945+
}
3946+
vpwallets.push_back(pwallet);
39443947
}
3945-
vpwallets.push_back(pwallet);
39463948

39473949
return true;
39483950
}

0 commit comments

Comments
 (0)