Merge #13114: wallet/keystore: Add Clang thread safety annotations for variables guarded by cs_KeyStore
968b76f77c
Add missing cs_KeyStore lock (practicalswift)4bcd5bb87d
Add locking annotations for variables guarded by cs_KeyStore (practicalswift) Pull request description: * Add Clang thread safety annotations for variables guarded by `cs_KeyStore` * Add missing `cs_KeyStore` lock Tree-SHA512: 7d93513c2da0cd564b9f1e75aa5156a454a4133eb845020fde8872e685dd5758353e93c33364aeea4a812c08353a810494e503a5ce160cc5be0af5af4bb2e6d7
This commit is contained in:
commit
5ba77df15d
3 changed files with 11 additions and 8 deletions
|
@ -49,10 +49,10 @@ class CBasicKeyStore : public CKeyStore
|
||||||
protected:
|
protected:
|
||||||
mutable CCriticalSection cs_KeyStore;
|
mutable CCriticalSection cs_KeyStore;
|
||||||
|
|
||||||
KeyMap mapKeys;
|
KeyMap mapKeys GUARDED_BY(cs_KeyStore);
|
||||||
WatchKeyMap mapWatchKeys;
|
WatchKeyMap mapWatchKeys GUARDED_BY(cs_KeyStore);
|
||||||
ScriptMap mapScripts;
|
ScriptMap mapScripts GUARDED_BY(cs_KeyStore);
|
||||||
WatchOnlySet setWatchOnly;
|
WatchOnlySet setWatchOnly GUARDED_BY(cs_KeyStore);
|
||||||
|
|
||||||
void ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
|
void ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ class CCryptoKeyStore : public CBasicKeyStore
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
CKeyingMaterial vMasterKey;
|
CKeyingMaterial vMasterKey GUARDED_BY(cs_KeyStore);
|
||||||
|
|
||||||
//! if fUseCrypto is true, mapKeys must be empty
|
//! if fUseCrypto is true, mapKeys must be empty
|
||||||
//! if fUseCrypto is false, vMasterKey must be empty
|
//! if fUseCrypto is false, vMasterKey must be empty
|
||||||
|
@ -132,7 +132,7 @@ protected:
|
||||||
bool EncryptKeys(CKeyingMaterial& vMasterKeyIn);
|
bool EncryptKeys(CKeyingMaterial& vMasterKeyIn);
|
||||||
|
|
||||||
bool Unlock(const CKeyingMaterial& vMasterKeyIn);
|
bool Unlock(const CKeyingMaterial& vMasterKeyIn);
|
||||||
CryptedKeyMap mapCryptedKeys;
|
CryptedKeyMap mapCryptedKeys GUARDED_BY(cs_KeyStore);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCryptoKeyStore() : fUseCrypto(false), fDecryptionThoroughlyChecked(false)
|
CCryptoKeyStore() : fUseCrypto(false), fDecryptionThoroughlyChecked(false)
|
||||||
|
|
|
@ -3168,8 +3168,11 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This wallet is in its first run if all of these are empty
|
{
|
||||||
fFirstRunRet = mapKeys.empty() && mapCryptedKeys.empty() && mapWatchKeys.empty() && setWatchOnly.empty() && mapScripts.empty();
|
LOCK(cs_KeyStore);
|
||||||
|
// This wallet is in its first run if all of these are empty
|
||||||
|
fFirstRunRet = mapKeys.empty() && mapCryptedKeys.empty() && mapWatchKeys.empty() && setWatchOnly.empty() && mapScripts.empty();
|
||||||
|
}
|
||||||
|
|
||||||
if (nLoadWalletRet != DBErrors::LOAD_OK)
|
if (nLoadWalletRet != DBErrors::LOAD_OK)
|
||||||
return nLoadWalletRet;
|
return nLoadWalletRet;
|
||||||
|
|
Loading…
Reference in a new issue