From 288b4ffb6b291f0466d513ff3c40af6758ca7c88 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 28 Jul 2020 19:25:14 -0400 Subject: 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".) --- src/wallet/load.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/wallet/load.cpp') 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 +#include #include #include #include @@ -44,16 +45,16 @@ bool VerifyWallets(interfaces::Chain& chain, const std::vector& wal std::set 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 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& walle for (const std::string& walletFile : wallet_files) { bilingual_str error; std::vector warnings; - std::shared_ptr pwallet = CWallet::CreateWalletFromFile(chain, WalletLocation(walletFile), error, warnings); + std::shared_ptr pwallet = CWallet::CreateWalletFromFile(chain, walletFile, error, warnings); if (!warnings.empty()) chain.initWarning(Join(warnings, Untranslated("\n"))); if (!pwallet) { chain.initError(error); -- cgit v1.2.3