aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/load.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-07-28 19:25:14 -0400
committerRussell Yanofsky <russ@yanofsky.org>2020-09-03 12:24:32 -0400
commit288b4ffb6b291f0466d513ff3c40af6758ca7c88 (patch)
treef8a6f5d532a5fca1f3229a4949165eef70ce5220 /src/wallet/load.cpp
parenta0a422c34cfd6514d0cc445bd784d3ee1a2d1749 (diff)
downloadbitcoin-288b4ffb6b291f0466d513ff3c40af6758ca7c88.tar.xz
Remove WalletLocation class
This removes a source of complexity and indirection that makes it harder to understand path checking code. Path checks will be simplified in upcoming commits. There is no change in behavior in this commit other than a slightly more descriptive error message in `loadwallet` if the default "" wallet can't be found. (The error message is improved more in upcoming commit "wallet: Remove path checking code from loadwallet RPC".)
Diffstat (limited to 'src/wallet/load.cpp')
-rw-r--r--src/wallet/load.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp
index 5bbc8b91f7..dde29842ec 100644
--- a/src/wallet/load.cpp
+++ b/src/wallet/load.cpp
@@ -5,6 +5,7 @@
#include <wallet/load.h>
+#include <fs.h>
#include <interfaces/chain.h>
#include <scheduler.h>
#include <util/string.h>
@@ -44,16 +45,16 @@ bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wal
std::set<fs::path> wallet_paths;
for (const auto& wallet_file : wallet_files) {
- WalletLocation location(wallet_file);
+ const fs::path path = fs::absolute(wallet_file, GetWalletDir());
- if (!wallet_paths.insert(location.GetPath()).second) {
+ if (!wallet_paths.insert(path).second) {
chain.initError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
return false;
}
bilingual_str error_string;
std::vector<bilingual_str> warnings;
- bool verify_success = CWallet::Verify(chain, location, error_string, warnings);
+ bool verify_success = CWallet::Verify(chain, wallet_file, error_string, warnings);
if (!warnings.empty()) chain.initWarning(Join(warnings, Untranslated("\n")));
if (!verify_success) {
chain.initError(error_string);
@@ -70,7 +71,7 @@ bool LoadWallets(interfaces::Chain& chain, const std::vector<std::string>& walle
for (const std::string& walletFile : wallet_files) {
bilingual_str error;
std::vector<bilingual_str> warnings;
- std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(chain, WalletLocation(walletFile), error, warnings);
+ std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(chain, walletFile, error, warnings);
if (!warnings.empty()) chain.initWarning(Join(warnings, Untranslated("\n")));
if (!pwallet) {
chain.initError(error);