aboutsummaryrefslogtreecommitdiff
path: root/src/keystore.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-08-31 10:24:45 -0700
committerGavin Andresen <gavinandresen@gmail.com>2011-08-31 10:24:45 -0700
commitcb6c4b883da6896b39bd46f845453f69d0f516f1 (patch)
treecc9de8e932d07cf2549a625e6c614a2677ec1b0e /src/keystore.cpp
parent21189a42a735ff66166c17c53eb44998346059d6 (diff)
parent471426fb3b2c2fa37640c03819c4f7be69ba8301 (diff)
downloadbitcoin-cb6c4b883da6896b39bd46f845453f69d0f516f1.tar.xz
Merge pull request #480 from gavinandresen/deadlocks
Simplify mutex locking, fix deadlocks. Fixes issue #453
Diffstat (limited to 'src/keystore.cpp')
-rw-r--r--src/keystore.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp
index 4c6848b47a..5bf919cb80 100644
--- a/src/keystore.cpp
+++ b/src/keystore.cpp
@@ -45,7 +45,7 @@ std::vector<unsigned char> CCryptoKeyStore::GenerateNewKey()
bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
{
- CRITICAL_BLOCK(cs_vMasterKey)
+ CRITICAL_BLOCK(cs_KeyStore)
{
if (!SetCrypted())
return false;
@@ -72,7 +72,6 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
bool CCryptoKeyStore::AddKey(const CKey& key)
{
CRITICAL_BLOCK(cs_KeyStore)
- CRITICAL_BLOCK(cs_vMasterKey)
{
if (!IsCrypted())
return CBasicKeyStore::AddKey(key);
@@ -106,7 +105,7 @@ bool CCryptoKeyStore::AddCryptedKey(const std::vector<unsigned char> &vchPubKey,
bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const
{
- CRITICAL_BLOCK(cs_vMasterKey)
+ CRITICAL_BLOCK(cs_KeyStore)
{
if (!IsCrypted())
return CBasicKeyStore::GetKey(address, keyOut);
@@ -128,7 +127,7 @@ bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const
bool CCryptoKeyStore::GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char>& vchPubKeyOut) const
{
- CRITICAL_BLOCK(cs_vMasterKey)
+ CRITICAL_BLOCK(cs_KeyStore)
{
if (!IsCrypted())
return CKeyStore::GetPubKey(address, vchPubKeyOut);
@@ -146,7 +145,6 @@ bool CCryptoKeyStore::GetPubKey(const CBitcoinAddress &address, std::vector<unsi
bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
{
CRITICAL_BLOCK(cs_KeyStore)
- CRITICAL_BLOCK(cs_vMasterKey)
{
if (!mapCryptedKeys.empty() || IsCrypted())
return false;