Skip to content

Commit

Permalink
refactor: Drop wallet path determination from VerifyWallets
Browse files Browse the repository at this point in the history
  • Loading branch information
promag committed Sep 19, 2020
1 parent 269ced8 commit c6a5cd7
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/wallet/load.cpp
Expand Up @@ -62,21 +62,19 @@ bool VerifyWallets(interfaces::Chain& chain)
std::set<fs::path> wallet_paths;

for (const auto& wallet_file : gArgs.GetArgs("-wallet")) {
const fs::path path = fs::absolute(wallet_file, GetWalletDir());

if (!wallet_paths.insert(path).second) {
chain.initError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
return false;
}

DatabaseOptions options;
DatabaseStatus status;
options.verify = true;
bilingual_str error_string;
if (!MakeWalletDatabase(wallet_file, options, status, error_string)) {
std::unique_ptr<WalletDatabase> database = MakeWalletDatabase(wallet_file, options, status, error_string);
if (!database) {
chain.initError(error_string);
return false;
}
if (!wallet_paths.insert(database->Filename()).second) {
chain.initError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
return false;
}
}

return true;
Expand Down

0 comments on commit c6a5cd7

Please sign in to comment.