@@ -710,13 +710,13 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
710
710
711
711
/* Used by TransactionAddedToMemorypool/BlockConnected/Disconnected.
712
712
* Should be called with pindexBlock and posInBlock if this is for a transaction that is included in a block. */
713
- void SyncTransaction (const CTransactionRef& tx, const CBlockIndex *pindex = nullptr , int posInBlock = 0 );
713
+ void SyncTransaction (const CTransactionRef& tx, const CBlockIndex *pindex = nullptr , int posInBlock = 0 ) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
714
714
715
715
/* the HD chain data model (external chain counters) */
716
716
CHDChain hdChain;
717
717
718
718
/* HD derive new child key (on internal or external chain) */
719
- void DeriveNewChildKey (WalletBatch &batch, CKeyMetadata& metadata, CKey& secret, bool internal = false );
719
+ void DeriveNewChildKey (WalletBatch &batch, CKeyMetadata& metadata, CKey& secret, bool internal = false ) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
720
720
721
721
std::set<int64_t > setInternalKeyPool;
722
722
std::set<int64_t > setExternalKeyPool;
@@ -735,7 +735,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
735
735
* of the other AddWatchOnly which accepts a timestamp and sets
736
736
* nTimeFirstKey more intelligently for more efficient rescans.
737
737
*/
738
- bool AddWatchOnly (const CScript& dest) override ;
738
+ bool AddWatchOnly (const CScript& dest) override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
739
739
740
740
/* *
741
741
* Wallet filename from wallet=<path> command line or config option.
@@ -786,7 +786,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
786
786
*/
787
787
const std::string& GetName () const { return m_name; }
788
788
789
- void LoadKeyPool (int64_t nIndex, const CKeyPool &keypool);
789
+ void LoadKeyPool (int64_t nIndex, const CKeyPool &keypool) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
790
790
void MarkPreSplitKeys ();
791
791
792
792
// Map from Key ID to key metadata.
@@ -828,12 +828,12 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
828
828
const CWalletTx* GetWalletTx (const uint256& hash) const ;
829
829
830
830
// ! check whether we are allowed to upgrade (or already support) to the named feature
831
- bool CanSupportFeature (enum WalletFeature wf) const { AssertLockHeld (cs_wallet); return nWalletMaxVersion >= wf; }
831
+ bool CanSupportFeature (enum WalletFeature wf) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { AssertLockHeld (cs_wallet); return nWalletMaxVersion >= wf; }
832
832
833
833
/* *
834
834
* populate vCoins with vector of available COutputs.
835
835
*/
836
- void AvailableCoins (std::vector<COutput>& vCoins, bool fOnlySafe =true , const CCoinControl *coinControl = nullptr , const CAmount& nMinimumAmount = 1 , const CAmount& nMaximumAmount = MAX_MONEY, const CAmount& nMinimumSumAmount = MAX_MONEY, const uint64_t nMaximumCount = 0 , const int nMinDepth = 0 , const int nMaxDepth = 9999999 ) const ;
836
+ void AvailableCoins (std::vector<COutput>& vCoins, bool fOnlySafe =true , const CCoinControl *coinControl = nullptr , const CAmount& nMinimumAmount = 1 , const CAmount& nMaximumAmount = MAX_MONEY, const CAmount& nMinimumSumAmount = MAX_MONEY, const uint64_t nMaximumCount = 0 , const int nMinDepth = 0 , const int nMaxDepth = 9999999 ) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
837
837
838
838
/* *
839
839
* Return list of available coins and locked coins grouped by non-change output address.
@@ -856,11 +856,11 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
856
856
857
857
bool IsSpent (const uint256& hash, unsigned int n) const ;
858
858
859
- bool IsLockedCoin (uint256 hash, unsigned int n) const ;
860
- void LockCoin (const COutPoint& output);
861
- void UnlockCoin (const COutPoint& output);
862
- void UnlockAllCoins ();
863
- void ListLockedCoins (std::vector<COutPoint>& vOutpts) const ;
859
+ bool IsLockedCoin (uint256 hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
860
+ void LockCoin (const COutPoint& output) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
861
+ void UnlockCoin (const COutPoint& output) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
862
+ void UnlockAllCoins () EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
863
+ void ListLockedCoins (std::vector<COutPoint>& vOutpts) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
864
864
865
865
/*
866
866
* Rescan abort properties
@@ -873,18 +873,18 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
873
873
* keystore implementation
874
874
* Generate a new key
875
875
*/
876
- CPubKey GenerateNewKey (WalletBatch& batch, bool internal = false );
876
+ CPubKey GenerateNewKey (WalletBatch& batch, bool internal = false ) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
877
877
// ! Adds a key to the store, and saves it to disk.
878
- bool AddKeyPubKey (const CKey& key, const CPubKey &pubkey) override ;
879
- bool AddKeyPubKeyWithDB (WalletBatch &batch,const CKey& key, const CPubKey &pubkey);
878
+ bool AddKeyPubKey (const CKey& key, const CPubKey &pubkey) override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
879
+ bool AddKeyPubKeyWithDB (WalletBatch &batch,const CKey& key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
880
880
// ! Adds a key to the store, without saving it to disk (used by LoadWallet)
881
881
bool LoadKey (const CKey& key, const CPubKey &pubkey) { return CCryptoKeyStore::AddKeyPubKey (key, pubkey); }
882
882
// ! Load metadata (used by LoadWallet)
883
- bool LoadKeyMetadata (const CKeyID& keyID, const CKeyMetadata &metadata);
884
- bool LoadScriptMetadata (const CScriptID& script_id, const CKeyMetadata &metadata);
883
+ bool LoadKeyMetadata (const CKeyID& keyID, const CKeyMetadata &metadata) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
884
+ bool LoadScriptMetadata (const CScriptID& script_id, const CKeyMetadata &metadata) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
885
885
886
- bool LoadMinVersion (int nVersion) { AssertLockHeld (cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max (nWalletMaxVersion, nVersion); return true ; }
887
- void UpdateTimeFirstKey (int64_t nCreateTime);
886
+ bool LoadMinVersion (int nVersion) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { AssertLockHeld (cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max (nWalletMaxVersion, nVersion); return true ; }
887
+ void UpdateTimeFirstKey (int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
888
888
889
889
// ! Adds an encrypted key to the store, and saves it to disk.
890
890
bool AddCryptedKey (const CPubKey &vchPubKey, const std::vector<unsigned char > &vchCryptedSecret) override ;
@@ -905,8 +905,8 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
905
905
std::vector<std::string> GetDestValues (const std::string& prefix) const ;
906
906
907
907
// ! Adds a watch-only address to the store, and saves it to disk.
908
- bool AddWatchOnly (const CScript& dest, int64_t nCreateTime);
909
- bool RemoveWatchOnly (const CScript &dest) override ;
908
+ bool AddWatchOnly (const CScript& dest, int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
909
+ bool RemoveWatchOnly (const CScript &dest) override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
910
910
// ! Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
911
911
bool LoadWatchOnly (const CScript &dest);
912
912
@@ -917,16 +917,16 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
917
917
bool ChangeWalletPassphrase (const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase);
918
918
bool EncryptWallet (const SecureString& strWalletPassphrase);
919
919
920
- void GetKeyBirthTimes (std::map<CTxDestination, int64_t > &mapKeyBirth) const ;
920
+ void GetKeyBirthTimes (std::map<CTxDestination, int64_t > &mapKeyBirth) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
921
921
unsigned int ComputeTimeSmart (const CWalletTx& wtx) const ;
922
922
923
923
/* *
924
924
* Increment the next transaction order id
925
925
* @return next transaction order id
926
926
*/
927
- int64_t IncOrderPosNext (WalletBatch *batch = nullptr );
927
+ int64_t IncOrderPosNext (WalletBatch *batch = nullptr ) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
928
928
DBErrors ReorderTransactions ();
929
- bool AccountMove (std::string strFrom, std::string strTo, CAmount nAmount, std::string strComment = " " );
929
+ bool AccountMove (std::string strFrom, std::string strTo, CAmount nAmount, std::string strComment = " " ) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
930
930
bool GetLabelDestination (CTxDestination &dest, const std::string& label, bool bForceNew = false );
931
931
932
932
void MarkDirty ();
@@ -935,7 +935,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
935
935
void TransactionAddedToMempool (const CTransactionRef& tx) override ;
936
936
void BlockConnected (const std::shared_ptr<const CBlock>& pblock, const CBlockIndex *pindex, const std::vector<CTransactionRef>& vtxConflicted) override ;
937
937
void BlockDisconnected (const std::shared_ptr<const CBlock>& pblock) override ;
938
- bool AddToWalletIfInvolvingMe (const CTransactionRef& tx, const CBlockIndex* pIndex, int posInBlock, bool fUpdate );
938
+ bool AddToWalletIfInvolvingMe (const CTransactionRef& tx, const CBlockIndex* pIndex, int posInBlock, bool fUpdate ) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
939
939
int64_t RescanFromTime (int64_t startTime, const WalletRescanReserver& reserver, bool update);
940
940
CBlockIndex* ScanForWalletTransactions (CBlockIndex* pindexStart, CBlockIndex* pindexStop, const WalletRescanReserver& reserver, bool fUpdate = false );
941
941
void TransactionRemovedFromMempool (const CTransactionRef &ptx) override ;
@@ -959,7 +959,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
959
959
* calling CreateTransaction();
960
960
*/
961
961
bool FundTransaction (CMutableTransaction& tx, CAmount& nFeeRet, int & nChangePosInOut, std::string& strFailReason, bool lockUnspents, const std::set<int >& setSubtractFeeFromOutputs, CCoinControl);
962
- bool SignTransaction (CMutableTransaction& tx);
962
+ bool SignTransaction (CMutableTransaction& tx) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
963
963
964
964
/* *
965
965
* Create a new transaction paying the recipients with a set of coins
@@ -999,7 +999,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
999
999
OutputType m_default_change_type{DEFAULT_CHANGE_TYPE};
1000
1000
1001
1001
bool NewKeyPool ();
1002
- size_t KeypoolCountExternalKeys ();
1002
+ size_t KeypoolCountExternalKeys () EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
1003
1003
bool TopUpKeyPool (unsigned int kpSize = 0 );
1004
1004
void ReserveKeyFromKeyPool (int64_t & nIndex, CKeyPool& keypool, bool fRequestedInternal );
1005
1005
void KeepKey (int64_t nIndex);
@@ -1009,10 +1009,10 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
1009
1009
/* *
1010
1010
* Marks all keys in the keypool up to and including reserve_key as used.
1011
1011
*/
1012
- void MarkReserveKeysAsUsed (int64_t keypool_id);
1012
+ void MarkReserveKeysAsUsed (int64_t keypool_id) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
1013
1013
const std::map<CKeyID, int64_t >& GetAllReserveKeys () const { return m_pool_key_to_index; }
1014
1014
1015
- std::set< std::set<CTxDestination> > GetAddressGroupings ();
1015
+ std::set<std::set<CTxDestination>> GetAddressGroupings () EXCLUSIVE_LOCKS_REQUIRED(cs_wallet );
1016
1016
std::map<CTxDestination, CAmount> GetAddressBalances ();
1017
1017
1018
1018
std::set<CTxDestination> GetLabelAddresses (const std::string& label) const ;
@@ -1040,7 +1040,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
1040
1040
1041
1041
DBErrors LoadWallet (bool & fFirstRunRet );
1042
1042
DBErrors ZapWalletTx (std::vector<CWalletTx>& vWtx);
1043
- DBErrors ZapSelectTx (std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
1043
+ DBErrors ZapSelectTx (std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
1044
1044
1045
1045
bool SetAddressBook (const CTxDestination& address, const std::string& strName, const std::string& purpose);
1046
1046
@@ -1060,7 +1060,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
1060
1060
1061
1061
void GetScriptForMining (std::shared_ptr<CReserveScript> &script);
1062
1062
1063
- unsigned int GetKeyPoolSize ()
1063
+ unsigned int GetKeyPoolSize () EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
1064
1064
{
1065
1065
AssertLockHeld (cs_wallet); // set{Ex,In}ternalKeyPool
1066
1066
return setInternalKeyPool.size () + setExternalKeyPool.size ();
@@ -1079,7 +1079,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
1079
1079
std::set<uint256> GetConflicts (const uint256& txid) const ;
1080
1080
1081
1081
// ! Check if a given transaction has any of its outputs spent by another transaction in the wallet
1082
- bool HasWalletSpend (const uint256& txid) const ;
1082
+ bool HasWalletSpend (const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) ;
1083
1083
1084
1084
// ! Flush wallet (bitdb flush)
1085
1085
void Flush (bool shutdown=false );
@@ -1156,7 +1156,7 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
1156
1156
* Obviously holding cs_main/cs_wallet when going into this call may cause
1157
1157
* deadlock
1158
1158
*/
1159
- void BlockUntilSyncedToCurrentChain ();
1159
+ void BlockUntilSyncedToCurrentChain () LOCKS_EXCLUDED(cs_wallet) ;
1160
1160
1161
1161
/* *
1162
1162
* Explicitly make the wallet learn the related scripts for outputs to the
0 commit comments