diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-07-11 15:09:19 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-07-11 15:09:24 -0400 |
commit | 5ba77df15de92deb35bfd501d4635aed3236af30 (patch) | |
tree | 3e0a1d4b217d9803957d833bddf9ad1265d932b3 /src/wallet | |
parent | e538a952d5f05b9547df51d4c2a5b8858f3ab100 (diff) | |
parent | 968b76f77ca51b9df737011ff486efbae9c8de81 (diff) |
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
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/crypter.h | 4 | ||||
-rw-r--r-- | src/wallet/wallet.cpp | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/wallet/crypter.h b/src/wallet/crypter.h index 4c0c8ff5ec..b0a75b7020 100644 --- a/src/wallet/crypter.h +++ b/src/wallet/crypter.h @@ -116,7 +116,7 @@ class CCryptoKeyStore : public CBasicKeyStore { private: - CKeyingMaterial vMasterKey; + CKeyingMaterial vMasterKey GUARDED_BY(cs_KeyStore); //! if fUseCrypto is true, mapKeys must be empty //! if fUseCrypto is false, vMasterKey must be empty @@ -132,7 +132,7 @@ protected: bool EncryptKeys(CKeyingMaterial& vMasterKeyIn); bool Unlock(const CKeyingMaterial& vMasterKeyIn); - CryptedKeyMap mapCryptedKeys; + CryptedKeyMap mapCryptedKeys GUARDED_BY(cs_KeyStore); public: CCryptoKeyStore() : fUseCrypto(false), fDecryptionThoroughlyChecked(false) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index aa9508a02d..cdba6c6441 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -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) return nLoadWalletRet; |