aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-12-20 17:37:52 -0500
committerMarcoFalke <falke.marco@gmail.com>2017-12-20 17:37:57 -0500
commit604e08c83cf58ca7e7cda2ab284c1ace7bb12977 (patch)
tree277c3aebee5e677bcf9e7654872d9411a00dfbbf
parent79399c8cd0b6030034eea5feed3a7523e369b256 (diff)
parentaac6b3f06717626b88cdfd140f2cc1a3f2dde4be (diff)
downloadbitcoin-604e08c83cf58ca7e7cda2ab284c1ace7bb12977.tar.xz
Merge #11726: Cleanups + nit fixes for walletdir PR
aac6b3f067 Update files.md for new wallets/ subdirectory (MeshCollider) b67342906c Cleanups for walletdir PR (MeshCollider) Pull request description: This addresses the remaining nits from https://github.com/bitcoin/bitcoin/pull/11466 - Updates `doc/files.md` with respect to the new default wallet directory - Fixes @promag and @laanwj's error message nit, and Jonas' release notes nit - ~Addresses @laanwj's net-specific wallet subdirectory concern in the case that a walletdir is specified~ - Changes the #includes from "" to <> style after #11651 Tree-SHA512: b86bf5fdc4de54c1b0f65b60a83af3cf82b35d216ce9c0de724803bfba6934796238b6c412659dcc29ae2e3e856d4eb97ae777c80f36f4089d8acecfddefe9aa
-rw-r--r--doc/files.md9
-rw-r--r--doc/release-notes.md2
-rw-r--r--src/wallet/init.cpp5
-rw-r--r--src/wallet/walletutil.cpp2
-rw-r--r--src/wallet/walletutil.h3
-rwxr-xr-xtest/functional/multiwallet.py6
6 files changed, 19 insertions, 8 deletions
diff --git a/doc/files.md b/doc/files.md
index 3d603445fb..2eac7ed664 100644
--- a/doc/files.md
+++ b/doc/files.md
@@ -6,13 +6,16 @@
* blocks/rev000??.dat; block undo data (custom); since 0.8.0 (format changed since pre-0.8)
* blocks/index/*; block index (LevelDB); since 0.8.0
* chainstate/*; block chain state database (LevelDB); since 0.8.0
-* database/*: BDB database environment; only used for wallet since 0.8.0
-* db.log: wallet database log file
+* database/*: BDB database environment; only used for wallet since 0.8.0; moved to wallets/ directory on new installs since 0.16.0
+* db.log: wallet database log file; moved to wallets/ directory on new installs since 0.16.0
* debug.log: contains debug information and general logging generated by bitcoind or bitcoin-qt
* fee_estimates.dat: stores statistics used to estimate minimum transaction fees and priorities required for confirmation; since 0.10.0
* mempool.dat: dump of the mempool's transactions; since 0.14.0.
* peers.dat: peer IP address database (custom format); since 0.7.0
-* wallet.dat: personal wallet (BDB) with keys and transactions
+* wallet.dat: personal wallet (BDB) with keys and transactions; moved to wallets/ directory on new installs since 0.16.0
+* wallets/database/*: BDB database environment; used for wallets since 0.16.0
+* wallets/db.log: wallet database log file; since 0.16.0
+* wallets/wallet.dat: personal wallet (BDB) with keys and transactions; since 0.16.0
* .cookie: session RPC authentication cookie (written at start when cookie authentication is used, deleted on shutdown): since 0.12.0
* onion_private_key: cached Tor hidden service private key for `-listenonion`: since 0.12.0
* guisettings.ini.bak: backup of former GUI settings after `-resetguisettings` is used
diff --git a/doc/release-notes.md b/doc/release-notes.md
index 78caddc8f0..9ff567d680 100644
--- a/doc/release-notes.md
+++ b/doc/release-notes.md
@@ -72,7 +72,7 @@ Custom wallet directories
The ability to specify a directory other than the default data directory in which to store
wallets has been added. An existing directory can be specified using the `-walletdir=<dir>`
argument. Wallets loaded via `-wallet` arguments must be in this wallet directory. Care should be taken
-when choosing a wallet directory location, as if it becomes unavailable during operation,
+when choosing a wallet directory location, as if it becomes unavailable during operation,
funds may be lost.
Default wallet directory change
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp
index 67c46df87d..788bac2a46 100644
--- a/src/wallet/init.cpp
+++ b/src/wallet/init.cpp
@@ -194,7 +194,10 @@ bool VerifyWallets()
}
if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) {
- return InitError(strprintf(_("Error: Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str()));
+ if (fs::exists(fs::system_complete(gArgs.GetArg("-walletdir", "")))) {
+ return InitError(strprintf(_("Specified -walletdir \"%s\" is not a directory"), gArgs.GetArg("-walletdir", "").c_str()));
+ }
+ return InitError(strprintf(_("Specified -walletdir \"%s\" does not exist"), gArgs.GetArg("-walletdir", "").c_str()));
}
LogPrintf("Using wallet directory %s\n", GetWalletDir().string());
diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp
index fbb5215a51..f15e5de1e2 100644
--- a/src/wallet/walletutil.cpp
+++ b/src/wallet/walletutil.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include "wallet/walletutil.h"
+#include <wallet/walletutil.h>
fs::path GetWalletDir()
{
diff --git a/src/wallet/walletutil.h b/src/wallet/walletutil.h
index a94f286a44..50ff736402 100644
--- a/src/wallet/walletutil.h
+++ b/src/wallet/walletutil.h
@@ -5,7 +5,8 @@
#ifndef BITCOIN_WALLET_UTIL_H
#define BITCOIN_WALLET_UTIL_H
-#include "util.h"
+#include <chainparamsbase.h>
+#include <util.h>
//! Get the path of the wallet directory.
fs::path GetWalletDir();
diff --git a/test/functional/multiwallet.py b/test/functional/multiwallet.py
index 06409b6f31..d0c40e5446 100755
--- a/test/functional/multiwallet.py
+++ b/test/functional/multiwallet.py
@@ -40,7 +40,11 @@ class MultiWalletTest(BitcoinTestFramework):
self.assert_start_raises_init_error(0, ['-wallet=w12'], 'Error loading wallet w12. -wallet filename must be a regular file.')
# should not initialize if the specified walletdir does not exist
- self.assert_start_raises_init_error(0, ['-walletdir=bad'], 'Error: Specified wallet directory "bad" does not exist.')
+ self.assert_start_raises_init_error(0, ['-walletdir=bad'], 'Error: Specified -walletdir "bad" does not exist')
+ # should not initialize if the specified walletdir is not a directory
+ not_a_dir = os.path.join(wallet_dir, 'notadir')
+ open(not_a_dir, 'a').close()
+ self.assert_start_raises_init_error(0, ['-walletdir='+not_a_dir], 'Error: Specified -walletdir "' + not_a_dir + '" is not a directory')
# if wallets/ doesn't exist, datadir should be the default wallet dir
wallet_dir2 = os.path.join(self.options.tmpdir, 'node0', 'regtest', 'walletdir')