Browse Source
0.16c1e5d40
Make debugging test crash easier (MeshCollider)8263f6a
Create walletdir if datadir doesn't exist and fix tests (MeshCollider)9587a9c
Default walletdir is wallets/ if it exists (MeshCollider)d987889
Add release notes for -walletdir and wallets/ dir (MeshCollider)80c5cbc
Add test for -walletdir (MeshCollider)0530ba0
Add -walletdir parameter to specify custom wallet dir (MeshCollider) Pull request description: Closes #11348 Adds a `-walletdir` parameter which specifies a directory to use for wallets, allowing them to be stored separately from the 'main' data directory. Creates a new `wallets/` directory in datadir if this is the first time running, and defaults to using it if it exists. Includes tests and release notes. Things which might need to be considered more: - there is no 'lock' on the wallets directory, which might be needed? - because this uses a new wallets/ directory by default, downgrading to an earlier version won't see the wallets in that directory (not a big deal though, users can just copy them up to the main dir) - jnewbery suggested putting each wallet in its own directory, which is a good idea, but out of scope for this PR IMO. EDIT: this is being done in https://github.com/bitcoin/bitcoin/pull/11687 - doc/files.md needs updating (will do soon) I also considered including a cleanup by removing caching of data directory paths and instead just initialise them once on startup (c.f. #3073), but decided it wasn't super relevant here will just complicate review. Tree-SHA512: c8ac04bfe9a810c32055f2c8b8fa0d535e56125ceb8d96f12447dd3538bf3e5ee992b60b1cd2173bf5f3fa023a9feab12c9963593bf27ed419df929bb413398d
Wladimir J. van der Laan
7 years ago
18 changed files with 144 additions and 46 deletions
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2017 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "wallet/walletutil.h" |
||||
|
||||
fs::path GetWalletDir() |
||||
{ |
||||
fs::path path; |
||||
|
||||
if (gArgs.IsArgSet("-walletdir")) { |
||||
path = fs::system_complete(gArgs.GetArg("-walletdir", "")); |
||||
if (!fs::is_directory(path)) { |
||||
// If the path specified doesn't exist, we return the deliberately
|
||||
// invalid empty string.
|
||||
path = ""; |
||||
} |
||||
} else { |
||||
path = GetDataDir(); |
||||
// If a wallets directory exists, use that, otherwise default to GetDataDir
|
||||
if (fs::is_directory(path / "wallets")) { |
||||
path /= "wallets"; |
||||
} |
||||
} |
||||
|
||||
return path; |
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2017 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_WALLET_UTIL_H |
||||
#define BITCOIN_WALLET_UTIL_H |
||||
|
||||
#include "util.h" |
||||
|
||||
//! Get the path of the wallet directory.
|
||||
fs::path GetWalletDir(); |
||||
|
||||
#endif // BITCOIN_WALLET_UTIL_H
|
Loading…
Reference in new issue