From 1749dd69c7562badc75746301c5aa364b768c6fa Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 31 Oct 2016 19:57:30 -0500 Subject: [PATCH] Fix incorrect locking in CCryptoKeyStore --- src/wallet/crypter.cpp | 4 ++-- src/wallet/crypter.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/crypter.cpp b/src/wallet/crypter.cpp index a5ef786d..69fe55eb 100644 --- a/src/wallet/crypter.cpp +++ b/src/wallet/crypter.cpp @@ -153,7 +153,7 @@ static bool DecryptSpendingKey(const CKeyingMaterial& vMasterKey, bool CCryptoKeyStore::SetCrypted() { - LOCK(cs_KeyStore); + LOCK2(cs_KeyStore, cs_SpendingKeyStore); if (fUseCrypto) return true; if (!(mapKeys.empty() && mapSpendingKeys.empty())) @@ -179,7 +179,7 @@ bool CCryptoKeyStore::Lock() bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) { { - LOCK(cs_KeyStore); + LOCK2(cs_KeyStore, cs_SpendingKeyStore); if (!SetCrypted()) return false; diff --git a/src/wallet/crypter.h b/src/wallet/crypter.h index b310b77b..d09cfa84 100644 --- a/src/wallet/crypter.h +++ b/src/wallet/crypter.h @@ -207,7 +207,7 @@ public: bool HaveSpendingKey(const libzcash::PaymentAddress &address) const { { - LOCK(cs_KeyStore); + LOCK(cs_SpendingKeyStore); if (!IsCrypted()) return CBasicKeyStore::HaveSpendingKey(address); return mapCryptedSpendingKeys.count(address) > 0;