Skip to content

Commit 604e08c

Browse files
author
MarcoFalke
committed
Merge #11726: Cleanups + nit fixes for walletdir PR
aac6b3f Update files.md for new wallets/ subdirectory (MeshCollider) b673429 Cleanups for walletdir PR (MeshCollider) Pull request description: This addresses the remaining nits from bitcoin/bitcoin#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
2 parents 79399c8 + aac6b3f commit 604e08c

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

doc/files.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
* blocks/rev000??.dat; block undo data (custom); since 0.8.0 (format changed since pre-0.8)
77
* blocks/index/*; block index (LevelDB); since 0.8.0
88
* chainstate/*; block chain state database (LevelDB); since 0.8.0
9-
* database/*: BDB database environment; only used for wallet since 0.8.0
10-
* db.log: wallet database log file
9+
* database/*: BDB database environment; only used for wallet since 0.8.0; moved to wallets/ directory on new installs since 0.16.0
10+
* db.log: wallet database log file; moved to wallets/ directory on new installs since 0.16.0
1111
* debug.log: contains debug information and general logging generated by bitcoind or bitcoin-qt
1212
* fee_estimates.dat: stores statistics used to estimate minimum transaction fees and priorities required for confirmation; since 0.10.0
1313
* mempool.dat: dump of the mempool's transactions; since 0.14.0.
1414
* peers.dat: peer IP address database (custom format); since 0.7.0
15-
* wallet.dat: personal wallet (BDB) with keys and transactions
15+
* wallet.dat: personal wallet (BDB) with keys and transactions; moved to wallets/ directory on new installs since 0.16.0
16+
* wallets/database/*: BDB database environment; used for wallets since 0.16.0
17+
* wallets/db.log: wallet database log file; since 0.16.0
18+
* wallets/wallet.dat: personal wallet (BDB) with keys and transactions; since 0.16.0
1619
* .cookie: session RPC authentication cookie (written at start when cookie authentication is used, deleted on shutdown): since 0.12.0
1720
* onion_private_key: cached Tor hidden service private key for `-listenonion`: since 0.12.0
1821
* guisettings.ini.bak: backup of former GUI settings after `-resetguisettings` is used

doc/release-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Custom wallet directories
7272
The ability to specify a directory other than the default data directory in which to store
7373
wallets has been added. An existing directory can be specified using the `-walletdir=<dir>`
7474
argument. Wallets loaded via `-wallet` arguments must be in this wallet directory. Care should be taken
75-
when choosing a wallet directory location, as if it becomes unavailable during operation,
75+
when choosing a wallet directory location, as if it becomes unavailable during operation,
7676
funds may be lost.
7777

7878
Default wallet directory change

src/wallet/init.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ bool VerifyWallets()
194194
}
195195

196196
if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) {
197-
return InitError(strprintf(_("Error: Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str()));
197+
if (fs::exists(fs::system_complete(gArgs.GetArg("-walletdir", "")))) {
198+
return InitError(strprintf(_("Specified -walletdir \"%s\" is not a directory"), gArgs.GetArg("-walletdir", "").c_str()));
199+
}
200+
return InitError(strprintf(_("Specified -walletdir \"%s\" does not exist"), gArgs.GetArg("-walletdir", "").c_str()));
198201
}
199202

200203
LogPrintf("Using wallet directory %s\n", GetWalletDir().string());

src/wallet/walletutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#include "wallet/walletutil.h"
5+
#include <wallet/walletutil.h>
66

77
fs::path GetWalletDir()
88
{

src/wallet/walletutil.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#ifndef BITCOIN_WALLET_UTIL_H
66
#define BITCOIN_WALLET_UTIL_H
77

8-
#include "util.h"
8+
#include <chainparamsbase.h>
9+
#include <util.h>
910

1011
//! Get the path of the wallet directory.
1112
fs::path GetWalletDir();

test/functional/multiwallet.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ def run_test(self):
4040
self.assert_start_raises_init_error(0, ['-wallet=w12'], 'Error loading wallet w12. -wallet filename must be a regular file.')
4141

4242
# should not initialize if the specified walletdir does not exist
43-
self.assert_start_raises_init_error(0, ['-walletdir=bad'], 'Error: Specified wallet directory "bad" does not exist.')
43+
self.assert_start_raises_init_error(0, ['-walletdir=bad'], 'Error: Specified -walletdir "bad" does not exist')
44+
# should not initialize if the specified walletdir is not a directory
45+
not_a_dir = os.path.join(wallet_dir, 'notadir')
46+
open(not_a_dir, 'a').close()
47+
self.assert_start_raises_init_error(0, ['-walletdir='+not_a_dir], 'Error: Specified -walletdir "' + not_a_dir + '" is not a directory')
4448

4549
# if wallets/ doesn't exist, datadir should be the default wallet dir
4650
wallet_dir2 = os.path.join(self.options.tmpdir, 'node0', 'regtest', 'walletdir')

0 commit comments

Comments
 (0)