aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-11-14 13:32:41 -0500
committerRussell Yanofsky <russ@yanofsky.org>2018-03-03 10:26:55 -0500
commit26c06f24e5dcc32a7599abb8d670d22993c82bc2 (patch)
treee8d9e757900e0c0d019a4a0b04c8fdd06e51c5fb /src/wallet
parentd8a99f65e53019becdd8d2631396012bafb29741 (diff)
downloadbitcoin-26c06f24e5dcc32a7599abb8d670d22993c82bc2.tar.xz
Allow wallet files not in -walletdir directory
Remove restriction that -wallet filenames can only refer to files in the -walletdir directory.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/db.cpp1
-rw-r--r--src/wallet/init.cpp10
2 files changed, 2 insertions, 9 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp
index 88463d10b2..0ef3b7e926 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -122,6 +122,7 @@ bool CDBEnv::Open(bool retry)
boost::this_thread::interruption_point();
fs::path pathIn = strPath;
+ TryCreateDirectories(pathIn);
if (!LockDirectory(pathIn, ".walletlock")) {
LogPrintf("Cannot obtain a lock on wallet directory %s. Another instance of bitcoin may be using it.\n", strPath);
return false;
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp
index 6e243c0a09..11fd067b4b 100644
--- a/src/wallet/init.cpp
+++ b/src/wallet/init.cpp
@@ -35,7 +35,7 @@ std::string GetWalletHelpString(bool showDebug)
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE));
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format on startup"));
- strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), DEFAULT_WALLET_DAT));
+ strUsage += HelpMessageOpt("-wallet=<path>", _("Specify wallet database path. Can be specified multiple times to load multiple wallets. Path is interpreted relative to <walletdir> if it is not absolute, and will be created if it does not exist.") + " " + strprintf(_("(default: %s)"), DEFAULT_WALLET_DAT));
strUsage += HelpMessageOpt("-walletbroadcast", _("Make the wallet broadcast transactions") + " " + strprintf(_("(default: %u)"), DEFAULT_WALLETBROADCAST));
strUsage += HelpMessageOpt("-walletdir=<dir>", _("Specify directory to hold wallets (default: <datadir>/wallets if it exists, otherwise <datadir>)"));
strUsage += HelpMessageOpt("-walletnotify=<cmd>", _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)"));
@@ -230,14 +230,6 @@ bool VerifyWallets()
std::set<fs::path> wallet_paths;
for (const std::string& walletFile : gArgs.GetArgs("-wallet")) {
- if (boost::filesystem::path(walletFile).filename() != walletFile) {
- return InitError(strprintf(_("Error loading wallet %s. -wallet parameter must only specify a filename (not a path)."), walletFile));
- }
-
- if (SanitizeString(walletFile, SAFE_CHARS_FILENAME) != walletFile) {
- return InitError(strprintf(_("Error loading wallet %s. Invalid characters in -wallet filename."), walletFile));
- }
-
fs::path wallet_path = fs::absolute(walletFile, GetWalletDir());
if (fs::exists(wallet_path) && (!fs::is_regular_file(wallet_path) || fs::is_symlink(wallet_path))) {