From 8c2960806f642e2a5fe78919a31e90aa6fd51a3b Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 1 Feb 2024 15:26:35 +0300 Subject: [PATCH] suggestions --- src/wallet/wallet.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6e52d23a876fc..5a97574813442 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -298,7 +298,7 @@ std::shared_ptr 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); } @@ -310,13 +310,6 @@ std::shared_ptr 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 @@ -329,6 +322,13 @@ std::shared_ptr 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;