Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 8 additions & 7 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3910,9 +3910,8 @@ bool CWallet::IsLocked(bool fForMixing) const
if (!IsCrypted())
return false;

if(!fForMixing && fOnlyMixingAllowed) return true;

LOCK(cs_wallet);
if (!fForMixing && fOnlyMixingAllowed) return true;
Comment thread
PastaPastaPasta marked this conversation as resolved.
return vMasterKey.empty();
}

Expand All @@ -3921,15 +3920,17 @@ bool CWallet::Lock(bool fAllowMixing)
if (!IsCrypted())
return false;

if(!fAllowMixing) {
{
LOCK(cs_wallet);
if (!vMasterKey.empty()) {
memory_cleanse(vMasterKey.data(), vMasterKey.size() * sizeof(decltype(vMasterKey)::value_type));
vMasterKey.clear();
if (!fAllowMixing) {
if (!vMasterKey.empty()) {
memory_cleanse(vMasterKey.data(), vMasterKey.size() * sizeof(decltype(vMasterKey)::value_type));
vMasterKey.clear();
}
}
fOnlyMixingAllowed = fAllowMixing;
}

fOnlyMixingAllowed = fAllowMixing;
NotifyStatusChanged(this);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
CKeyingMaterial vMasterKey GUARDED_BY(cs_wallet);

//! if fOnlyMixingAllowed is true, only mixing should be allowed in unlocked wallet
bool fOnlyMixingAllowed{false};
bool fOnlyMixingAllowed GUARDED_BY(cs_wallet){false};

bool Unlock(const CKeyingMaterial& vMasterKeyIn, bool fForMixingOnly = false);

Expand Down
Loading