X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.h;h=b6df1aa0e177cf84da82af92a4ce88969ceb16d8;hb=7a15d4ff67c9a6e3b6b5a63f82f76ffe1937c3b8;hp=cc1dde5b0f3ac5821dd5437c6bb100c9c343ad8b;hpb=f43f46c175d7e6d7426536f8efcad05d2eafba80;p=novacoin.git diff --git a/src/wallet.h b/src/wallet.h index cc1dde5..b6df1aa 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -20,14 +20,14 @@ private: bool SelectCoins(int64 nTargetValue, std::set >& setCoinsRet, int64& nValueRet) const; CWalletDB *pwalletdbEncryption; - CCriticalSection cs_pwalletdbEncryption; public: + mutable CCriticalSection cs_wallet; + bool fFileBacked; std::string strWalletFile; std::set setKeyPool; - CCriticalSection cs_setKeyPool; typedef std::map MasterKeyMap; MasterKeyMap mapMasterKeys; @@ -47,15 +47,12 @@ public: pwalletdbEncryption = NULL; } - mutable CCriticalSection cs_mapWallet; std::map mapWallet; std::vector vWalletUpdated; std::map mapRequestCount; - mutable CCriticalSection cs_mapRequestCount; std::map mapAddressBook; - mutable CCriticalSection cs_mapAddressBook; std::vector vchDefaultKey; @@ -89,7 +86,7 @@ public: void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool); void KeepKey(int64 nIndex); void ReturnKey(int64 nIndex); - std::vector GetOrReuseKeyFromPool(); + bool GetKeyFromPool(std::vector &key, bool fAllowReuse=true); int64 GetOldestKeyPoolTime(); bool IsMine(const CTxIn& txin) const; @@ -108,7 +105,7 @@ public: { CBitcoinAddress address; if (ExtractAddress(txout.scriptPubKey, this, address)) - CRITICAL_BLOCK(cs_mapAddressBook) + CRITICAL_BLOCK(cs_wallet) if (!mapAddressBook.count(address)) return true; return false; @@ -172,15 +169,13 @@ public: int LoadWallet(bool& fFirstRunRet); // bool BackupWallet(const std::string& strDest); - // requires cs_mapAddressBook lock bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName); - // requires cs_mapAddressBook lock bool DelAddressBookName(const CBitcoinAddress& address); void UpdatedTransaction(const uint256 &hashTx) { - CRITICAL_BLOCK(cs_mapWallet) + CRITICAL_BLOCK(cs_wallet) vWalletUpdated.push_back(hashTx); } @@ -188,7 +183,7 @@ public: void Inventory(const uint256 &hash) { - CRITICAL_BLOCK(cs_mapRequestCount) + CRITICAL_BLOCK(cs_wallet) { std::map::iterator mi = mapRequestCount.find(hash); if (mi != mapRequestCount.end())