diff options
Diffstat (limited to 'src/wallet.h')
-rw-r--r-- | src/wallet.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/wallet.h b/src/wallet.h index 99f6293b1e..e4452a3093 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -105,6 +105,11 @@ private: int64_t nLastResend; public: + /// Main wallet lock. + /// This lock protects all the fields added by CWallet + /// except for: + /// fFileBacked (immutable after instantiation) + /// strWalletFile (immutable after instantiation) mutable CCriticalSection cs_wallet; bool fFileBacked; @@ -154,10 +159,11 @@ public: int64_t nTimeFirstKey; // check whether we are allowed to upgrade (or already support) to the named feature - bool CanSupportFeature(enum WalletFeature wf) { return nWalletMaxVersion >= wf; } + bool CanSupportFeature(enum WalletFeature wf) { AssertLockHeld(cs_wallet); return nWalletMaxVersion >= wf; } void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl = NULL) const; bool SelectCoinsMinConf(int64_t nTargetValue, int nConfMine, int nConfTheirs, std::vector<COutput> vCoins, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet) const; + bool IsLockedCoin(uint256 hash, unsigned int n) const; void LockCoin(COutPoint& output); void UnlockCoin(COutPoint& output); @@ -174,7 +180,7 @@ public: // Load metadata (used by LoadWallet) bool LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &metadata); - bool LoadMinVersion(int nVersion) { nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; } + bool LoadMinVersion(int nVersion) { AssertLockHeld(cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; } // Adds an encrypted key to the store, and saves it to disk. bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret); @@ -323,6 +329,7 @@ public: unsigned int GetKeyPoolSize() { + AssertLockHeld(cs_wallet); // setKeyPool return setKeyPool.size(); } @@ -335,7 +342,7 @@ public: bool SetMaxVersion(int nVersion); // get the current wallet format (the oldest client version guaranteed to understand this wallet) - int GetVersion() { return nWalletVersion; } + int GetVersion() { AssertLockHeld(cs_wallet); return nWalletVersion; } /** Address book entry changed. * @note called with lock cs_wallet held. |