Fix incorrect locking in CCryptoKeyStore
This commit is contained in:
parent
1feaefac51
commit
1749dd69c7
|
@ -153,7 +153,7 @@ static bool DecryptSpendingKey(const CKeyingMaterial& vMasterKey,
|
||||||
|
|
||||||
bool CCryptoKeyStore::SetCrypted()
|
bool CCryptoKeyStore::SetCrypted()
|
||||||
{
|
{
|
||||||
LOCK(cs_KeyStore);
|
LOCK2(cs_KeyStore, cs_SpendingKeyStore);
|
||||||
if (fUseCrypto)
|
if (fUseCrypto)
|
||||||
return true;
|
return true;
|
||||||
if (!(mapKeys.empty() && mapSpendingKeys.empty()))
|
if (!(mapKeys.empty() && mapSpendingKeys.empty()))
|
||||||
|
@ -179,7 +179,7 @@ bool CCryptoKeyStore::Lock()
|
||||||
bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
|
bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
LOCK(cs_KeyStore);
|
LOCK2(cs_KeyStore, cs_SpendingKeyStore);
|
||||||
if (!SetCrypted())
|
if (!SetCrypted())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ public:
|
||||||
bool HaveSpendingKey(const libzcash::PaymentAddress &address) const
|
bool HaveSpendingKey(const libzcash::PaymentAddress &address) const
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
LOCK(cs_KeyStore);
|
LOCK(cs_SpendingKeyStore);
|
||||||
if (!IsCrypted())
|
if (!IsCrypted())
|
||||||
return CBasicKeyStore::HaveSpendingKey(address);
|
return CBasicKeyStore::HaveSpendingKey(address);
|
||||||
return mapCryptedSpendingKeys.count(address) > 0;
|
return mapCryptedSpendingKeys.count(address) > 0;
|
||||||
|
|
Loading…
Reference in New Issue