diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index b3840905ea..678022e1f2 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -331,7 +331,7 @@ void LegacyScriptPubKeyMan::MarkUnusedAddresses(WalletBatch &batch, const CScrip void LegacyScriptPubKeyMan::UpgradeKeyMetadata() { LOCK(cs_KeyStore); // mapKeyMetadata - if (m_storage.IsLocked() || m_storage.IsWalletFlagSet(WALLET_FLAG_KEY_ORIGIN_METADATA) || !IsHDEnabled()) { + if (m_storage.IsLocked(false) || m_storage.IsWalletFlagSet(WALLET_FLAG_KEY_ORIGIN_METADATA) || !IsHDEnabled()) { return; } @@ -1901,7 +1901,7 @@ void DescriptorScriptPubKeyMan::ReturnDestination(int64_t index, bool internal, std::map DescriptorScriptPubKeyMan::GetKeys() const { AssertLockHeld(cs_desc_man); - if (m_storage.HasEncryptionKeys() && !m_storage.IsLocked()) { + if (m_storage.HasEncryptionKeys() && !m_storage.IsLocked(true)) { KeyMap keys; for (auto key_pair : m_map_crypted_keys) { const CPubKey& pubkey = key_pair.second.first; @@ -2014,7 +2014,7 @@ bool DescriptorScriptPubKeyMan::AddDescriptorKeyWithDB(WalletBatch& batch, const } if (m_storage.HasEncryptionKeys()) { - if (m_storage.IsLocked()) { + if (m_storage.IsLocked(true)) { return false; } @@ -2423,7 +2423,7 @@ bool DescriptorScriptPubKeyMan::GetDescriptorString(std::string& out) const void DescriptorScriptPubKeyMan::UpgradeDescriptorCache() { LOCK(cs_desc_man); - if (m_storage.IsLocked() || m_storage.IsWalletFlagSet(WALLET_FLAG_LAST_HARDENED_XPUB_CACHED)) { + if (m_storage.IsLocked(false) || m_storage.IsWalletFlagSet(WALLET_FLAG_LAST_HARDENED_XPUB_CACHED)) { return; } diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h index 7188ce9d1d..9c639b73eb 100644 --- a/src/wallet/scriptpubkeyman.h +++ b/src/wallet/scriptpubkeyman.h @@ -40,7 +40,7 @@ public: virtual void SetMinVersion(enum WalletFeature, WalletBatch* = nullptr) = 0; virtual const CKeyingMaterial& GetEncryptionKey() const = 0; virtual bool HasEncryptionKeys() const = 0; - virtual bool IsLocked(bool fForMixing = false) const = 0; + virtual bool IsLocked(bool fForMixing) const = 0; // for LegacyScriptPubKeyMan::TopUpInner needs: virtual void UpdateProgress(const std::string&, int) = 0; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 4bd880888c..29d6104270 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -5459,21 +5459,11 @@ bool CWallet::IsLocked(bool fForMixing) const { if (!IsCrypted()) return false; - bool result; - { - LOCK(cs_wallet); - result = vMasterKey.empty(); - } - // fForMixing fOnlyMixingAllowed return - // --------------------------------------- - // true true result - // true false result - // false true true - // false false result if(!fForMixing && fOnlyMixingAllowed) return true; - return result; + LOCK(cs_wallet); + return vMasterKey.empty(); } bool CWallet::Lock(bool fAllowMixing)