Use correct lock for spending keys

This commit is contained in:
Jack Grigg 2016-09-29 11:35:18 +13:00
parent ad041fceec
commit ef3a6a97ae
1 changed files with 4 additions and 4 deletions

View File

@ -303,7 +303,7 @@ bool CCryptoKeyStore::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) co
bool CCryptoKeyStore::AddSpendingKey(const libzcash::SpendingKey &sk)
{
{
LOCK(cs_KeyStore);
LOCK(cs_SpendingKeyStore);
if (!IsCrypted())
return CBasicKeyStore::AddSpendingKey(sk);
@ -329,7 +329,7 @@ bool CCryptoKeyStore::AddCryptedSpendingKey(const libzcash::PaymentAddress &addr
const std::vector<unsigned char> &vchCryptedSecret)
{
{
LOCK(cs_KeyStore);
LOCK(cs_SpendingKeyStore);
if (!SetCrypted())
return false;
@ -342,7 +342,7 @@ bool CCryptoKeyStore::AddCryptedSpendingKey(const libzcash::PaymentAddress &addr
bool CCryptoKeyStore::GetSpendingKey(const libzcash::PaymentAddress &address, libzcash::SpendingKey &skOut) const
{
{
LOCK(cs_KeyStore);
LOCK(cs_SpendingKeyStore);
if (!IsCrypted())
return CBasicKeyStore::GetSpendingKey(address, skOut);
@ -359,7 +359,7 @@ bool CCryptoKeyStore::GetSpendingKey(const libzcash::PaymentAddress &address, li
bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
{
{
LOCK(cs_KeyStore);
LOCK2(cs_KeyStore, cs_SpendingKeyStore);
if (!mapCryptedKeys.empty() || IsCrypted())
return false;