Auto merge of #1747 - str4d:fix-spendingkey-locking, r=str4d

Fix incorrect locking in CCryptoKeyStore
This commit is contained in:
Homu 2017-06-15 16:02:07 -07:00
commit 6189c70caa
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;