Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <chainparams.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <crypto/common.h>
#include <fs.h>
#include <interfaces/chain.h>
Expand All @@ -19,7 +18,6 @@
#include <key_io.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <policy/settings.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <script/descriptor.h>
Expand All @@ -28,10 +26,8 @@
#include <script/signingprovider.h>
#include <support/cleanse.h>
#include <txmempool.h>
#include <util/bip32.h>
#include <util/check.h>
#include <util/error.h>
#include <util/fees.h>
#include <util/moneystr.h>
#include <util/string.h>
#include <util/translation.h>
Expand All @@ -40,11 +36,9 @@
#endif
#include <wallet/bip39.h> // TODO(refactor): move dependency it to scriptpubkeyman.cpp
#include <wallet/coincontrol.h>
#include <wallet/coinselection.h>
#include <wallet/context.h>
#include <warnings.h>

#include <coinjoin/common.h>
#include <coinjoin/options.h>
#include <evo/providertx.h>
#include <governance/vote.h>
Expand Down Expand Up @@ -3228,7 +3222,24 @@ bool CWallet::UpgradeToHD(const SecureString& secureMnemonic, const SecureString
SetMinVersion(FEATURE_HD);

if (IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
if (IsCrypted()) {
if (secureWalletPassphrase.empty()) {
error = Untranslated("Error: Wallet encrypted but supplied empty wallet passphrase");
return false;
}

// Unlock the wallet
if (!Unlock(secureWalletPassphrase)) {
error = Untranslated("Error: The wallet passphrase entered was incorrect");
return false;
}
}
SetupDescriptorScriptPubKeyMans(secureMnemonic, secureMnemonicPassphrase);

if (IsCrypted()) {
// Relock the wallet
Lock();
}
} else {
if (!GenerateNewHDChain(secureMnemonic, secureMnemonicPassphrase, secureWalletPassphrase)) {
error = Untranslated("Failed to generate HD wallet");
Expand Down
Loading