mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
wallet: Refactor to use WalletLocation
This commit is contained in:
@@ -211,15 +211,15 @@ bool WalletInit::Verify() const
|
||||
std::set<fs::path> wallet_paths;
|
||||
|
||||
for (const auto& wallet_file : wallet_files) {
|
||||
fs::path wallet_path = fs::absolute(wallet_file, GetWalletDir());
|
||||
WalletLocation location(wallet_file);
|
||||
|
||||
if (!wallet_paths.insert(wallet_path).second) {
|
||||
if (!wallet_paths.insert(location.GetPath()).second) {
|
||||
return InitError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
|
||||
}
|
||||
|
||||
std::string error_string;
|
||||
std::string warning_string;
|
||||
bool verify_success = CWallet::Verify(wallet_file, salvage_wallet, error_string, warning_string);
|
||||
bool verify_success = CWallet::Verify(location, salvage_wallet, error_string, warning_string);
|
||||
if (!error_string.empty()) InitError(error_string);
|
||||
if (!warning_string.empty()) InitWarning(warning_string);
|
||||
if (!verify_success) return false;
|
||||
@@ -236,7 +236,7 @@ bool WalletInit::Open() const
|
||||
}
|
||||
|
||||
for (const std::string& walletFile : gArgs.GetArgs("-wallet")) {
|
||||
std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(walletFile, fs::absolute(walletFile, GetWalletDir()));
|
||||
std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(WalletLocation(walletFile));
|
||||
if (!pwallet) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user