Skip to content

Commit 46eb275

Browse files
committed
Merge #14350: Add WalletLocation class
65f3672 wallet: Refactor to use WalletLocation (João Barbosa) 01a4c09 wallet: Add WalletLocation utility class (João Barbosa) Pull request description: Advantages of this change: - avoid resolving wallet absolute path and name repetitively and in multiple places; - avoid calling `GetWalletDir` in multiple places; - extract these details from the actual wallet implementation. The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory. Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686
2 parents 69d574a + 65f3672 commit 46eb275

13 files changed

+85
-58
lines changed

src/bench/coin_selection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void addCoin(const CAmount& nValue, const CWallet& wallet, std::vector<Ou
3333
// (https://github.com/bitcoin/bitcoin/issues/7883#issuecomment-224807484)
3434
static void CoinSelection(benchmark::State& state)
3535
{
36-
const CWallet wallet("dummy", WalletDatabase::CreateDummy());
36+
const CWallet wallet(WalletLocation(), WalletDatabase::CreateDummy());
3737
LOCK(wallet.cs_wallet);
3838

3939
// Add coins.
@@ -57,7 +57,7 @@ static void CoinSelection(benchmark::State& state)
5757
}
5858

5959
typedef std::set<CInputCoin> CoinSet;
60-
static const CWallet testWallet("dummy", WalletDatabase::CreateDummy());
60+
static const CWallet testWallet(WalletLocation(), WalletDatabase::CreateDummy());
6161
std::vector<std::unique_ptr<CWalletTx>> wtxn;
6262

6363
// Copied from src/wallet/test/coinselector_tests.cpp

src/qt/test/addressbooktests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void EditAddressAndSubmit(
5656
void TestAddAddressesToSendBook()
5757
{
5858
TestChain100Setup test;
59-
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>("mock", WalletDatabase::CreateMock());
59+
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(WalletLocation(), WalletDatabase::CreateMock());
6060
bool firstRun;
6161
wallet->LoadWallet(firstRun);
6262

src/qt/test/wallettests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void TestGUI()
132132
for (int i = 0; i < 5; ++i) {
133133
test.CreateAndProcessBlock({}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey()));
134134
}
135-
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>("mock", WalletDatabase::CreateMock());
135+
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(WalletLocation(), WalletDatabase::CreateMock());
136136
bool firstRun;
137137
wallet->LoadWallet(firstRun);
138138
{

src/wallet/init.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ bool WalletInit::Verify() const
211211
std::set<fs::path> wallet_paths;
212212

213213
for (const auto& wallet_file : wallet_files) {
214-
fs::path wallet_path = fs::absolute(wallet_file, GetWalletDir());
214+
WalletLocation location(wallet_file);
215215

216-
if (!wallet_paths.insert(wallet_path).second) {
216+
if (!wallet_paths.insert(location.GetPath()).second) {
217217
return InitError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
218218
}
219219

220220
std::string error_string;
221221
std::string warning_string;
222-
bool verify_success = CWallet::Verify(wallet_file, salvage_wallet, error_string, warning_string);
222+
bool verify_success = CWallet::Verify(location, salvage_wallet, error_string, warning_string);
223223
if (!error_string.empty()) InitError(error_string);
224224
if (!warning_string.empty()) InitWarning(warning_string);
225225
if (!verify_success) return false;
@@ -236,7 +236,7 @@ bool WalletInit::Open() const
236236
}
237237

238238
for (const std::string& walletFile : gArgs.GetArgs("-wallet")) {
239-
std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(walletFile, fs::absolute(walletFile, GetWalletDir()));
239+
std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(WalletLocation(walletFile));
240240
if (!pwallet) {
241241
return false;
242242
}

src/wallet/rpcwallet.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,26 +2405,26 @@ static UniValue loadwallet(const JSONRPCRequest& request)
24052405
+ HelpExampleCli("loadwallet", "\"test.dat\"")
24062406
+ HelpExampleRpc("loadwallet", "\"test.dat\"")
24072407
);
2408-
std::string wallet_file = request.params[0].get_str();
2408+
2409+
WalletLocation location(request.params[0].get_str());
24092410
std::string error;
24102411

2411-
fs::path wallet_path = fs::absolute(wallet_file, GetWalletDir());
2412-
if (fs::symlink_status(wallet_path).type() == fs::file_not_found) {
2413-
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Wallet " + wallet_file + " not found.");
2414-
} else if (fs::is_directory(wallet_path)) {
2412+
if (!location.Exists()) {
2413+
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Wallet " + location.GetName() + " not found.");
2414+
} else if (fs::is_directory(location.GetPath())) {
24152415
// The given filename is a directory. Check that there's a wallet.dat file.
2416-
fs::path wallet_dat_file = wallet_path / "wallet.dat";
2416+
fs::path wallet_dat_file = location.GetPath() / "wallet.dat";
24172417
if (fs::symlink_status(wallet_dat_file).type() == fs::file_not_found) {
2418-
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Directory " + wallet_file + " does not contain a wallet.dat file.");
2418+
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Directory " + location.GetName() + " does not contain a wallet.dat file.");
24192419
}
24202420
}
24212421

24222422
std::string warning;
2423-
if (!CWallet::Verify(wallet_file, false, error, warning)) {
2423+
if (!CWallet::Verify(location, false, error, warning)) {
24242424
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet file verification failed: " + error);
24252425
}
24262426

2427-
std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile(wallet_file, fs::absolute(wallet_file, GetWalletDir()));
2427+
std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile(location);
24282428
if (!wallet) {
24292429
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet loading failed.");
24302430
}
@@ -2458,7 +2458,6 @@ static UniValue createwallet(const JSONRPCRequest& request)
24582458
+ HelpExampleRpc("createwallet", "\"testwallet\"")
24592459
);
24602460
}
2461-
std::string wallet_name = request.params[0].get_str();
24622461
std::string error;
24632462
std::string warning;
24642463

@@ -2467,17 +2466,17 @@ static UniValue createwallet(const JSONRPCRequest& request)
24672466
disable_privatekeys = request.params[1].get_bool();
24682467
}
24692468

2470-
fs::path wallet_path = fs::absolute(wallet_name, GetWalletDir());
2471-
if (fs::symlink_status(wallet_path).type() != fs::file_not_found) {
2472-
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet " + wallet_name + " already exists.");
2469+
WalletLocation location(request.params[0].get_str());
2470+
if (location.Exists()) {
2471+
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet " + location.GetName() + " already exists.");
24732472
}
24742473

24752474
// Wallet::Verify will check if we're trying to create a wallet with a duplication name.
2476-
if (!CWallet::Verify(wallet_name, false, error, warning)) {
2475+
if (!CWallet::Verify(location, false, error, warning)) {
24772476
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet file verification failed: " + error);
24782477
}
24792478

2480-
std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile(wallet_name, fs::absolute(wallet_name, GetWalletDir()), (disable_privatekeys ? (uint64_t)WALLET_FLAG_DISABLE_PRIVATE_KEYS : 0));
2479+
std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile(location, (disable_privatekeys ? (uint64_t)WALLET_FLAG_DISABLE_PRIVATE_KEYS : 0));
24812480
if (!wallet) {
24822481
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet creation failed.");
24832482
}

src/wallet/test/coinselector_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ std::vector<std::unique_ptr<CWalletTx>> wtxn;
2828
typedef std::set<CInputCoin> CoinSet;
2929

3030
static std::vector<COutput> vCoins;
31-
static CWallet testWallet("dummy", WalletDatabase::CreateDummy());
31+
static CWallet testWallet(WalletLocation(), WalletDatabase::CreateDummy());
3232
static CAmount balance = 0;
3333

3434
CoinEligibilityFilter filter_standard(1, 6, 0);

src/wallet/test/wallet_test_fixture.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
#include <rpc/server.h>
88
#include <wallet/db.h>
9+
#include <wallet/rpcwallet.h>
910

1011
WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
11-
TestingSetup(chainName), m_wallet("mock", WalletDatabase::CreateMock())
12+
TestingSetup(chainName), m_wallet(WalletLocation(), WalletDatabase::CreateMock())
1213
{
1314
bool fFirstRun;
1415
m_wallet.LoadWallet(fFirstRun);

src/wallet/test/wallet_tests.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
4646
// Verify ScanForWalletTransactions picks up transactions in both the old
4747
// and new block files.
4848
{
49-
CWallet wallet("dummy", WalletDatabase::CreateDummy());
49+
CWallet wallet(WalletLocation(), WalletDatabase::CreateDummy());
5050
AddKey(wallet, coinbaseKey);
5151
WalletRescanReserver reserver(&wallet);
5252
reserver.reserve();
@@ -61,7 +61,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
6161
// Verify ScanForWalletTransactions only picks transactions in the new block
6262
// file.
6363
{
64-
CWallet wallet("dummy", WalletDatabase::CreateDummy());
64+
CWallet wallet(WalletLocation(), WalletDatabase::CreateDummy());
6565
AddKey(wallet, coinbaseKey);
6666
WalletRescanReserver reserver(&wallet);
6767
reserver.reserve();
@@ -73,7 +73,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
7373
// before the missing block, and success for a key whose creation time is
7474
// after.
7575
{
76-
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>("dummy", WalletDatabase::CreateDummy());
76+
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(WalletLocation(), WalletDatabase::CreateDummy());
7777
AddWallet(wallet);
7878
UniValue keys;
7979
keys.setArray();
@@ -134,7 +134,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
134134

135135
// Import key into wallet and call dumpwallet to create backup file.
136136
{
137-
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>("dummy", WalletDatabase::CreateDummy());
137+
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(WalletLocation(), WalletDatabase::CreateDummy());
138138
LOCK(wallet->cs_wallet);
139139
wallet->mapKeyMetadata[coinbaseKey.GetPubKey().GetID()].nCreateTime = KEY_TIME;
140140
wallet->AddKeyPubKey(coinbaseKey, coinbaseKey.GetPubKey());
@@ -150,7 +150,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
150150
// Call importwallet RPC and verify all blocks with timestamps >= BLOCK_TIME
151151
// were scanned, and no prior blocks were scanned.
152152
{
153-
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>("dummy", WalletDatabase::CreateDummy());
153+
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(WalletLocation(), WalletDatabase::CreateDummy());
154154

155155
JSONRPCRequest request;
156156
request.params.setArray();
@@ -180,7 +180,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
180180
// debit functions.
181181
BOOST_FIXTURE_TEST_CASE(coin_mark_dirty_immature_credit, TestChain100Setup)
182182
{
183-
CWallet wallet("dummy", WalletDatabase::CreateDummy());
183+
CWallet wallet(WalletLocation(), WalletDatabase::CreateDummy());
184184
CWalletTx wtx(&wallet, m_coinbase_txns.back());
185185
LOCK2(cs_main, wallet.cs_wallet);
186186
wtx.hashBlock = chainActive.Tip()->GetBlockHash();
@@ -273,7 +273,7 @@ class ListCoinsTestingSetup : public TestChain100Setup
273273
ListCoinsTestingSetup()
274274
{
275275
CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
276-
wallet = MakeUnique<CWallet>("mock", WalletDatabase::CreateMock());
276+
wallet = MakeUnique<CWallet>(WalletLocation(), WalletDatabase::CreateMock());
277277
bool firstRun;
278278
wallet->LoadWallet(firstRun);
279279
AddKey(*wallet, coinbaseKey);
@@ -377,7 +377,7 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
377377

378378
BOOST_FIXTURE_TEST_CASE(wallet_disableprivkeys, TestChain100Setup)
379379
{
380-
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>("dummy", WalletDatabase::CreateDummy());
380+
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(WalletLocation(), WalletDatabase::CreateDummy());
381381
wallet->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
382382
BOOST_CHECK(!wallet->TopUpKeyPool(1000));
383383
CPubKey pubkey;

src/wallet/wallet.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <txmempool.h>
2828
#include <util/moneystr.h>
2929
#include <wallet/fees.h>
30-
#include <wallet/walletutil.h>
3130

3231
#include <algorithm>
3332
#include <assert.h>
@@ -3826,7 +3825,7 @@ void CWallet::MarkPreSplitKeys()
38263825
}
38273826
}
38283827

3829-
bool CWallet::Verify(std::string wallet_file, bool salvage_wallet, std::string& error_string, std::string& warning_string)
3828+
bool CWallet::Verify(const WalletLocation& location, bool salvage_wallet, std::string& error_string, std::string& warning_string)
38303829
{
38313830
// Do some checking on wallet path. It should be either a:
38323831
//
@@ -3835,23 +3834,23 @@ bool CWallet::Verify(std::string wallet_file, bool salvage_wallet, std::string&
38353834
// 3. Path to a symlink to a directory.
38363835
// 4. For backwards compatibility, the name of a data file in -walletdir.
38373836
LOCK(cs_wallets);
3838-
fs::path wallet_path = fs::absolute(wallet_file, GetWalletDir());
3837+
const fs::path& wallet_path = location.GetPath();
38393838
fs::file_type path_type = fs::symlink_status(wallet_path).type();
38403839
if (!(path_type == fs::file_not_found || path_type == fs::directory_file ||
38413840
(path_type == fs::symlink_file && fs::is_directory(wallet_path)) ||
3842-
(path_type == fs::regular_file && fs::path(wallet_file).filename() == wallet_file))) {
3841+
(path_type == fs::regular_file && fs::path(location.GetName()).filename() == location.GetName()))) {
38433842
error_string = strprintf(
38443843
"Invalid -wallet path '%s'. -wallet path should point to a directory where wallet.dat and "
38453844
"database/log.?????????? files can be stored, a location where such a directory could be created, "
38463845
"or (for backwards compatibility) the name of an existing data file in -walletdir (%s)",
3847-
wallet_file, GetWalletDir());
3846+
location.GetName(), GetWalletDir());
38483847
return false;
38493848
}
38503849

38513850
// Make sure that the wallet path doesn't clash with an existing wallet path
38523851
for (auto wallet : GetWallets()) {
3853-
if (fs::absolute(wallet->GetName(), GetWalletDir()) == wallet_path) {
3854-
error_string = strprintf("Error loading wallet %s. Duplicate -wallet filename specified.", wallet_file);
3852+
if (wallet->GetLocation().GetPath() == wallet_path) {
3853+
error_string = strprintf("Error loading wallet %s. Duplicate -wallet filename specified.", location.GetName());
38553854
return false;
38563855
}
38573856
}
@@ -3861,13 +3860,13 @@ bool CWallet::Verify(std::string wallet_file, bool salvage_wallet, std::string&
38613860
return false;
38623861
}
38633862
} catch (const fs::filesystem_error& e) {
3864-
error_string = strprintf("Error loading wallet %s. %s", wallet_file, fsbridge::get_filesystem_error_message(e));
3863+
error_string = strprintf("Error loading wallet %s. %s", location.GetName(), fsbridge::get_filesystem_error_message(e));
38653864
return false;
38663865
}
38673866

38683867
if (salvage_wallet) {
38693868
// Recover readable keypairs:
3870-
CWallet dummyWallet("dummy", WalletDatabase::CreateDummy());
3869+
CWallet dummyWallet(WalletLocation(), WalletDatabase::CreateDummy());
38713870
std::string backup_filename;
38723871
if (!WalletBatch::Recover(wallet_path, (void *)&dummyWallet, WalletBatch::RecoverKeysOnlyFilter, backup_filename)) {
38733872
return false;
@@ -3877,17 +3876,17 @@ bool CWallet::Verify(std::string wallet_file, bool salvage_wallet, std::string&
38773876
return WalletBatch::VerifyDatabaseFile(wallet_path, warning_string, error_string);
38783877
}
38793878

3880-
std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const std::string& name, const fs::path& path, uint64_t wallet_creation_flags)
3879+
std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const WalletLocation& location, uint64_t wallet_creation_flags)
38813880
{
3882-
const std::string& walletFile = name;
3881+
const std::string& walletFile = location.GetName();
38833882

38843883
// needed to restore wallet transaction meta data after -zapwallettxes
38853884
std::vector<CWalletTx> vWtx;
38863885

38873886
if (gArgs.GetBoolArg("-zapwallettxes", false)) {
38883887
uiInterface.InitMessage(_("Zapping all transactions from wallet..."));
38893888

3890-
std::unique_ptr<CWallet> tempWallet = MakeUnique<CWallet>(name, WalletDatabase::Create(path));
3889+
std::unique_ptr<CWallet> tempWallet = MakeUnique<CWallet>(location, WalletDatabase::Create(location.GetPath()));
38913890
DBErrors nZapWalletRet = tempWallet->ZapWalletTx(vWtx);
38923891
if (nZapWalletRet != DBErrors::LOAD_OK) {
38933892
InitError(strprintf(_("Error loading %s: Wallet corrupted"), walletFile));
@@ -3901,7 +3900,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const std::string& name,
39013900
bool fFirstRun = true;
39023901
// TODO: Can't use std::make_shared because we need a custom deleter but
39033902
// should be possible to use std::allocate_shared.
3904-
std::shared_ptr<CWallet> walletInstance(new CWallet(name, WalletDatabase::Create(path)), ReleaseWallet);
3903+
std::shared_ptr<CWallet> walletInstance(new CWallet(location, WalletDatabase::Create(location.GetPath())), ReleaseWallet);
39053904
DBErrors nLoadWalletRet = walletInstance->LoadWallet(fFirstRun);
39063905
if (nLoadWalletRet != DBErrors::LOAD_OK)
39073906
{

src/wallet/wallet.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <wallet/crypter.h>
2121
#include <wallet/coinselection.h>
2222
#include <wallet/walletdb.h>
23-
#include <wallet/rpcwallet.h>
23+
#include <wallet/walletutil.h>
2424

2525
#include <algorithm>
2626
#include <atomic>
@@ -676,12 +676,8 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
676676
*/
677677
bool AddWatchOnly(const CScript& dest) override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
678678

679-
/**
680-
* Wallet filename from wallet=<path> command line or config option.
681-
* Used in debug logs and to send RPCs to the right wallet instance when
682-
* more than one wallet is loaded.
683-
*/
684-
std::string m_name;
679+
/** Wallet location which includes wallet name (see WalletLocation). */
680+
WalletLocation m_location;
685681

686682
/** Internal database handle. */
687683
std::unique_ptr<WalletDatabase> database;
@@ -721,9 +717,11 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
721717
bool SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAmount& nTargetValue, std::set<CInputCoin>& setCoinsRet, CAmount& nValueRet,
722718
const CCoinControl& coin_control, CoinSelectionParams& coin_selection_params, bool& bnb_used) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
723719

720+
const WalletLocation& GetLocation() const { return m_location; }
721+
724722
/** Get a name for this wallet for logging/debugging purposes.
725723
*/
726-
const std::string& GetName() const { return m_name; }
724+
const std::string& GetName() const { return m_location.GetName(); }
727725

728726
void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
729727
void MarkPreSplitKeys() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
@@ -739,7 +737,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
739737
unsigned int nMasterKeyMaxID = 0;
740738

741739
/** Construct wallet with specified name and database implementation. */
742-
CWallet(std::string name, std::unique_ptr<WalletDatabase> database) : m_name(std::move(name)), database(std::move(database))
740+
CWallet(const WalletLocation& location, std::unique_ptr<WalletDatabase> database) : m_location(location), database(std::move(database))
743741
{
744742
}
745743

@@ -1059,10 +1057,10 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
10591057
bool MarkReplaced(const uint256& originalHash, const uint256& newHash);
10601058

10611059
//! Verify wallet naming and perform salvage on the wallet if required
1062-
static bool Verify(std::string wallet_file, bool salvage_wallet, std::string& error_string, std::string& warning_string);
1060+
static bool Verify(const WalletLocation& location, bool salvage_wallet, std::string& error_string, std::string& warning_string);
10631061

10641062
/* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */
1065-
static std::shared_ptr<CWallet> CreateWalletFromFile(const std::string& name, const fs::path& path, uint64_t wallet_creation_flags = 0);
1063+
static std::shared_ptr<CWallet> CreateWalletFromFile(const WalletLocation& location, uint64_t wallet_creation_flags = 0);
10661064

10671065
/**
10681066
* Wallet post-init setup

0 commit comments

Comments
 (0)