Skip to content

Commit

Permalink
suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 authored and knst committed Feb 1, 2024
1 parent af49d5a commit 8c29608
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ std::shared_ptr<CWallet> CreateWallet(interfaces::Chain& chain, interfaces::Coin
return nullptr;
}
if (gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET)) {
LogPrintf("set HD by default\n");
wallet->WalletLogPrintf("Set HD by default\n");
wallet->SetMinVersion(FEATURE_HD);
}

Expand All @@ -310,13 +310,6 @@ std::shared_ptr<CWallet> CreateWallet(interfaces::Chain& chain, interfaces::Coin
return nullptr;
}
if (!create_blank) {
// Unlock the wallet
if (!wallet->Unlock(passphrase)) {
error = Untranslated("Error: Wallet was encrypted but could not be unlocked");
status = DatabaseStatus::FAILED_ENCRYPT;
return nullptr;
}

{
// TODO: drop this condition after removing option to create non-HD wallets
// related backport bitcoin#11250
Expand All @@ -329,6 +322,13 @@ std::shared_ptr<CWallet> CreateWallet(interfaces::Chain& chain, interfaces::Coin
}
}

// Unlock the wallet
if (!wallet->Unlock(passphrase)) {
error = Untranslated("Error: Wallet was encrypted but could not be unlocked");
status = DatabaseStatus::FAILED_ENCRYPT;
return nullptr;
}

// backup the wallet we just encrypted
if (!wallet->AutoBackupWallet("", error, warnings) && !error.original.empty()) {
status = DatabaseStatus::FAILED_ENCRYPT;
Expand Down

0 comments on commit 8c29608

Please sign in to comment.