diff --git a/src/coinjoin/client.h b/src/coinjoin/client.h index fb0a257729..40a633fc48 100644 --- a/src/coinjoin/client.h +++ b/src/coinjoin/client.h @@ -150,7 +150,7 @@ private: /// step 1: prepare denominated inputs and outputs bool PrepareDenominate(int nMinRounds, int nMaxRounds, std::string& strErrorRet, const std::vector& vecTxDSIn, std::vector >& vecPSInOutPairsRet, bool fDryRun = false); /// step 2: send denominated inputs and outputs prepared in step 1 - bool SendDenominate(const std::vector >& vecPSInOutPairsIn, CConnman& connman) LOCKS_EXCLUDED(cs_coinjoin); + bool SendDenominate(const std::vector >& vecPSInOutPairsIn, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); /// Process Masternode updates about the progress of mixing void ProcessPoolStateUpdate(CCoinJoinStatusUpdate psssup); @@ -160,7 +160,7 @@ private: void CompletedTransaction(PoolMessage nMessageID); /// As a client, check and sign the final transaction - bool SignFinalTransaction(const CTxMemPool& mempool, const CTransaction& finalTransactionNew, CNode& peer, CConnman& connman) LOCKS_EXCLUDED(cs_coinjoin); + bool SignFinalTransaction(const CTxMemPool& mempool, const CTransaction& finalTransactionNew, CNode& peer, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); void RelayIn(const CCoinJoinEntry& entry, CConnman& connman) const; @@ -174,14 +174,14 @@ public: void UnlockCoins(); - void ResetPool() LOCKS_EXCLUDED(cs_coinjoin); + void ResetPool() EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); bilingual_str GetStatus(bool fWaitForBlock) const; bool GetMixingMasternodeInfo(CDeterministicMNCPtr& ret) const; /// Passively run mixing in the background according to the configuration in settings - bool DoAutomaticDenominating(CConnman& connman, CTxMemPool& mempool, bool fDryRun = false) LOCKS_EXCLUDED(cs_coinjoin); + bool DoAutomaticDenominating(CConnman& connman, CTxMemPool& mempool, bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); /// As a client, submit part of a future mixing transaction to a Masternode to start the process bool SubmitDenominate(CConnman& connman); @@ -212,7 +212,7 @@ public: CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync, bool is_masternode) : connman(_connman), m_walletman(walletman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mn_sync(mn_sync), m_is_masternode{is_masternode} {}; - PeerMsgRet ProcessMessage(const CNode& peer, std::string_view msg_type, CDataStream& vRecv) LOCKS_EXCLUDED(cs_vecqueue); + PeerMsgRet ProcessMessage(const CNode& peer, std::string_view msg_type, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue); PeerMsgRet ProcessDSQueue(const CNode& peer, CDataStream& vRecv); void DoMaintenance(); }; @@ -267,27 +267,27 @@ public: m_wallet(wallet), m_walletman(walletman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mn_sync(mn_sync), m_queueman(queueman), m_is_masternode{is_masternode} {} - void ProcessMessage(CNode& peer, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv) LOCKS_EXCLUDED(cs_deqsessions); + void ProcessMessage(CNode& peer, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); bool StartMixing(); void StopMixing(); bool IsMixing() const; - void ResetPool() LOCKS_EXCLUDED(cs_deqsessions); + void ResetPool() EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); - bilingual_str GetStatuses() LOCKS_EXCLUDED(cs_deqsessions); - std::string GetSessionDenoms() LOCKS_EXCLUDED(cs_deqsessions); + bilingual_str GetStatuses() EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); + std::string GetSessionDenoms() EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); - bool GetMixingMasternodesInfo(std::vector& vecDmnsRet) const LOCKS_EXCLUDED(cs_deqsessions); + bool GetMixingMasternodesInfo(std::vector& vecDmnsRet) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); /// Passively run mixing in the background according to the configuration in settings - bool DoAutomaticDenominating(CConnman& connman, CTxMemPool& mempool, bool fDryRun = false) LOCKS_EXCLUDED(cs_deqsessions); + bool DoAutomaticDenominating(CConnman& connman, CTxMemPool& mempool, bool fDryRun = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); - bool TrySubmitDenominate(const CService& mnAddr, CConnman& connman) LOCKS_EXCLUDED(cs_deqsessions); - bool MarkAlreadyJoinedQueueAsTried(CCoinJoinQueue& dsq) const LOCKS_EXCLUDED(cs_deqsessions); + bool TrySubmitDenominate(const CService& mnAddr, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); + bool MarkAlreadyJoinedQueueAsTried(CCoinJoinQueue& dsq) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); - void CheckTimeout() LOCKS_EXCLUDED(cs_deqsessions); + void CheckTimeout() EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); - void ProcessPendingDsaRequest(CConnman& connman) LOCKS_EXCLUDED(cs_deqsessions); + void ProcessPendingDsaRequest(CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); void AddUsedMasternode(const COutPoint& outpointMn); CDeterministicMNCPtr GetRandomNotUsedMasternode(); @@ -296,9 +296,9 @@ public: void UpdatedBlockTip(const CBlockIndex* pindex); - void DoMaintenance(CConnman& connman, CTxMemPool& mempool); + void DoMaintenance(CConnman& connman, CTxMemPool& mempool) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); - void GetJsonInfo(UniValue& obj) const LOCKS_EXCLUDED(cs_deqsessions); + void GetJsonInfo(UniValue& obj) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); }; #endif // BITCOIN_COINJOIN_CLIENT_H diff --git a/src/coinjoin/coinjoin.h b/src/coinjoin/coinjoin.h index 20bbbd808d..bb42917d32 100644 --- a/src/coinjoin/coinjoin.h +++ b/src/coinjoin/coinjoin.h @@ -319,7 +319,7 @@ public: int GetState() const { return nState; } std::string GetStateString() const; - int GetEntriesCount() const LOCKS_EXCLUDED(cs_coinjoin) { LOCK(cs_coinjoin); return vecEntries.size(); } + int GetEntriesCount() const EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin) { LOCK(cs_coinjoin); return vecEntries.size(); } int GetEntriesCountLocked() const EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin) { return vecEntries.size(); } }; @@ -332,14 +332,14 @@ protected: // The current mixing sessions in progress on the network std::vector vecCoinJoinQueue GUARDED_BY(cs_vecqueue); - void SetNull() LOCKS_EXCLUDED(cs_vecqueue); - void CheckQueue() LOCKS_EXCLUDED(cs_vecqueue); + void SetNull() EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue); + void CheckQueue() EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue); public: CCoinJoinBaseManager() = default; - int GetQueueSize() const LOCKS_EXCLUDED(cs_vecqueue) { LOCK(cs_vecqueue); return vecCoinJoinQueue.size(); } - bool GetQueueItemAndTry(CCoinJoinQueue& dsqRet) LOCKS_EXCLUDED(cs_vecqueue); + int GetQueueSize() const EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue) { LOCK(cs_vecqueue); return vecCoinJoinQueue.size(); } + bool GetQueueItemAndTry(CCoinJoinQueue& dsqRet) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue); }; // Various helpers and dstx manager implementation @@ -365,15 +365,15 @@ class CDSTXManager public: CDSTXManager() = default; - void AddDSTX(const CCoinJoinBroadcastTx& dstx) LOCKS_EXCLUDED(cs_mapdstx); - CCoinJoinBroadcastTx GetDSTX(const uint256& hash) LOCKS_EXCLUDED(cs_mapdstx); + void AddDSTX(const CCoinJoinBroadcastTx& dstx) EXCLUSIVE_LOCKS_REQUIRED(!cs_mapdstx); + CCoinJoinBroadcastTx GetDSTX(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(!cs_mapdstx); void UpdatedBlockTip(const CBlockIndex* pindex, const llmq::CChainLocksHandler& clhandler, const CMasternodeSync& mn_sync); void NotifyChainLock(const CBlockIndex* pindex, const llmq::CChainLocksHandler& clhandler, const CMasternodeSync& mn_sync); - void TransactionAddedToMempool(const CTransactionRef& tx) LOCKS_EXCLUDED(cs_mapdstx); - void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindex) LOCKS_EXCLUDED(cs_mapdstx); - void BlockDisconnected(const std::shared_ptr& pblock, const CBlockIndex*) LOCKS_EXCLUDED(cs_mapdstx); + void TransactionAddedToMempool(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(!cs_mapdstx); + void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs_mapdstx); + void BlockDisconnected(const std::shared_ptr& pblock, const CBlockIndex*) EXCLUSIVE_LOCKS_REQUIRED(!cs_mapdstx); private: void CheckDSTXes(const CBlockIndex* pindex, const llmq::CChainLocksHandler& clhandler); diff --git a/src/coinjoin/server.h b/src/coinjoin/server.h index 9ce4a993cc..beaebb1eab 100644 --- a/src/coinjoin/server.h +++ b/src/coinjoin/server.h @@ -44,12 +44,12 @@ private: bool fUnitTest; /// Add a clients entry to the pool - bool AddEntry(const CCoinJoinEntry& entry, PoolMessage& nMessageIDRet) LOCKS_EXCLUDED(cs_coinjoin); + bool AddEntry(const CCoinJoinEntry& entry, PoolMessage& nMessageIDRet) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); /// Add signature to a txin - bool AddScriptSig(const CTxIn& txin) LOCKS_EXCLUDED(cs_coinjoin); + bool AddScriptSig(const CTxIn& txin) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); /// Charge fees to bad actors (Charge clients a fee if they're abusive) - void ChargeFees() const LOCKS_EXCLUDED(cs_coinjoin); + void ChargeFees() const EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); /// Rarely charge fees to pay miners void ChargeRandomFees() const; /// Consume collateral in cases when peer misbehaved @@ -58,18 +58,18 @@ private: /// Check for process void CheckPool(); - void CreateFinalTransaction() LOCKS_EXCLUDED(cs_coinjoin); - void CommitFinalTransaction() LOCKS_EXCLUDED(cs_coinjoin); + void CreateFinalTransaction() EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); + void CommitFinalTransaction() EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); /// Is this nDenom and txCollateral acceptable? bool IsAcceptableDSA(const CCoinJoinAccept& dsa, PoolMessage& nMessageIDRet) const; - bool CreateNewSession(const CCoinJoinAccept& dsa, PoolMessage& nMessageIDRet) LOCKS_EXCLUDED(cs_vecqueue); + bool CreateNewSession(const CCoinJoinAccept& dsa, PoolMessage& nMessageIDRet) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue); bool AddUserToExistingSession(const CCoinJoinAccept& dsa, PoolMessage& nMessageIDRet); /// Do we have enough users to take entries? bool IsSessionReady() const; /// Check that all inputs are signed. (Are all inputs signed?) - bool IsSignaturesComplete() const LOCKS_EXCLUDED(cs_coinjoin); + bool IsSignaturesComplete() const EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); /// Check to make sure a given input matches an input in the pool and its scriptSig is valid bool IsInputScriptSigValid(const CTxIn& txin) const EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin); @@ -80,12 +80,12 @@ private: void RelayFinalTransaction(const CTransaction& txFinal) EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin); void PushStatus(CNode& peer, PoolStatusUpdate nStatusUpdate, PoolMessage nMessageID) const; void RelayStatus(PoolStatusUpdate nStatusUpdate, PoolMessage nMessageID = MSG_NOERR) EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin); - void RelayCompletedTransaction(PoolMessage nMessageID) LOCKS_EXCLUDED(cs_coinjoin); + void RelayCompletedTransaction(PoolMessage nMessageID) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); - void ProcessDSACCEPT(CNode& peer, CDataStream& vRecv) LOCKS_EXCLUDED(cs_vecqueue); - PeerMsgRet ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv) LOCKS_EXCLUDED(cs_vecqueue); - void ProcessDSVIN(CNode& peer, CDataStream& vRecv) LOCKS_EXCLUDED(cs_coinjoin); - void ProcessDSSIGNFINALTX(CDataStream& vRecv) LOCKS_EXCLUDED(cs_coinjoin); + void ProcessDSACCEPT(CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue); + PeerMsgRet ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue); + void ProcessDSVIN(CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); + void ProcessDSSIGNFINALTX(CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin); void SetNull() override EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin); diff --git a/src/coinjoin/util.h b/src/coinjoin/util.h index c216f6a81d..16bece0df5 100644 --- a/src/coinjoin/util.h +++ b/src/coinjoin/util.h @@ -33,9 +33,9 @@ private: std::vector > storage GUARDED_BY(cs_storage); public: - CScript AddKey(CWallet* pwalletIn) LOCKS_EXCLUDED(cs_storage); - void KeepAll() LOCKS_EXCLUDED(cs_storage); - void ReturnAll() LOCKS_EXCLUDED(cs_storage); + CScript AddKey(CWallet* pwalletIn) EXCLUSIVE_LOCKS_REQUIRED(!cs_storage); + void KeepAll() EXCLUSIVE_LOCKS_REQUIRED(!cs_storage); + void ReturnAll() EXCLUSIVE_LOCKS_REQUIRED(!cs_storage); }; /** @@ -103,39 +103,40 @@ public: CTransactionBuilder(std::shared_ptr pwalletIn, const CompactTallyItem& tallyItemIn); ~CTransactionBuilder(); /// Check it would be possible to add a single output with the amount nAmount. Returns true if its possible and false if not. - bool CouldAddOutput(CAmount nAmountOutput) const; + bool CouldAddOutput(CAmount nAmountOutput) const EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); /// Check if its possible to add multiple outputs as vector of amounts. Returns true if its possible to add all of them and false if not. - bool CouldAddOutputs(const std::vector& vecOutputAmounts) const; + bool CouldAddOutputs(const std::vector& vecOutputAmounts) const EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); /// Add an output with the amount nAmount. Returns a pointer to the output if it could be added and nullptr if not due to insufficient amount left. - CTransactionBuilderOutput* AddOutput(CAmount nAmountOutput = 0) LOCKS_EXCLUDED(cs_outputs); + CTransactionBuilderOutput* AddOutput(CAmount nAmountOutput = 0) EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); /// Get amount we had available when we started CAmount GetAmountInitial() const { return tallyItem.nAmount; } /// Get the amount currently left to add more outputs. Does respect fees. - CAmount GetAmountLeft() const { return GetAmountInitial() - GetAmountUsed() - GetFee(GetBytesTotal()); } + CAmount GetAmountLeft() const EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs) + { return GetAmountInitial() - GetAmountUsed() - GetFee(GetBytesTotal()); } /// Check if an amounts should be considered as dust bool IsDust(CAmount nAmount) const; /// Get the total number of added outputs int CountOutputs() const { LOCK(cs_outputs); return vecOutputs.size(); } /// Create and Commit the transaction to the wallet - bool Commit(bilingual_str& strResult) LOCKS_EXCLUDED(cs_outputs); + bool Commit(bilingual_str& strResult) EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); /// Convert to a string - std::string ToString() const; + std::string ToString() const EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); private: /// Clear the output vector and keep/return the included keys depending on the value of fKeepKeys - void Clear() LOCKS_EXCLUDED(cs_outputs); + void Clear() EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); /// Get the total number of bytes used already by this transaction - unsigned int GetBytesTotal() const LOCKS_EXCLUDED(cs_outputs); + unsigned int GetBytesTotal() const EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); /// Helper to calculate static amount left by simply subtracting an used amount and a fee from a provided initial amount. static CAmount GetAmountLeft(CAmount nAmountInitial, CAmount nAmountUsed, CAmount nFee); /// Get the amount currently used by added outputs. Does not include fees. - CAmount GetAmountUsed() const LOCKS_EXCLUDED(cs_outputs); + CAmount GetAmountUsed() const EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); /// Get fees based on the number of bytes and the feerate set in CoinControl. /// NOTE: To get the total transaction fee this should only be called once with the total number of bytes for the transaction to avoid /// calling CFeeRate::GetFee multiple times with subtotals as this may add rounding errors with each further call. CAmount GetFee(unsigned int nBytes) const; /// Helper to get GetSizeOfCompactSizeDiff(vecOutputs.size(), vecOutputs.size() + nAdd) - int GetSizeOfCompactSizeDiff(size_t nAdd) const LOCKS_EXCLUDED(cs_outputs); + int GetSizeOfCompactSizeDiff(size_t nAdd) const EXCLUSIVE_LOCKS_REQUIRED(!cs_outputs); }; #endif // BITCOIN_COINJOIN_UTIL_H diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index df6072c4bc..9202f19b22 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -603,21 +603,21 @@ public: ~CDeterministicMNManager() = default; bool ProcessBlock(const CBlock& block, gsl::not_null pindex, BlockValidationState& state, - const CCoinsViewCache& view, bool fJustCheck, std::optional& updatesRet) EXCLUSIVE_LOCKS_REQUIRED(cs_main) LOCKS_EXCLUDED(cs); - bool UndoBlock(gsl::not_null pindex, std::optional& updatesRet) LOCKS_EXCLUDED(cs); + const CCoinsViewCache& view, bool fJustCheck, std::optional& updatesRet) EXCLUSIVE_LOCKS_REQUIRED(!cs, cs_main); + bool UndoBlock(gsl::not_null pindex, std::optional& updatesRet) EXCLUSIVE_LOCKS_REQUIRED(!cs); - void UpdatedBlockTip(gsl::not_null pindex) LOCKS_EXCLUDED(cs); + void UpdatedBlockTip(gsl::not_null pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs); // the returned list will not contain the correct block hash (we can't know it yet as the coinbase TX is not updated yet) bool BuildNewListFromBlock(const CBlock& block, gsl::not_null pindexPrev, BlockValidationState& state, const CCoinsViewCache& view, - CDeterministicMNList& mnListRet, bool debugLogs) LOCKS_EXCLUDED(cs); + CDeterministicMNList& mnListRet, bool debugLogs) EXCLUSIVE_LOCKS_REQUIRED(!cs); void HandleQuorumCommitment(const llmq::CFinalCommitment& qc, gsl::not_null pQuorumBaseBlockIndex, CDeterministicMNList& mnList, bool debugLogs); - CDeterministicMNList GetListForBlock(gsl::not_null pindex) LOCKS_EXCLUDED(cs) { + CDeterministicMNList GetListForBlock(gsl::not_null pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs) { LOCK(cs); return GetListForBlockInternal(pindex); }; - CDeterministicMNList GetListAtChainTip() LOCKS_EXCLUDED(cs); + CDeterministicMNList GetListAtChainTip() EXCLUSIVE_LOCKS_REQUIRED(!cs); // Test if given TX is a ProRegTx which also contains the collateral at index n static bool IsProTxWithCollateral(const CTransactionRef& tx, uint32_t n); @@ -625,7 +625,7 @@ public: bool MigrateDBIfNeeded(); bool MigrateDBIfNeeded2(); - void DoMaintenance() LOCKS_EXCLUDED(cs); + void DoMaintenance() EXCLUSIVE_LOCKS_REQUIRED(!cs); private: void CleanupCache(int nHeight) EXCLUSIVE_LOCKS_REQUIRED(cs); diff --git a/src/evo/evodb.h b/src/evo/evodb.h index 5debd14430..a0d6407606 100644 --- a/src/evo/evodb.h +++ b/src/evo/evodb.h @@ -48,7 +48,7 @@ private: public: explicit CEvoDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false); - std::unique_ptr BeginTransaction() LOCKS_EXCLUDED(cs) + std::unique_ptr BeginTransaction() EXCLUSIVE_LOCKS_REQUIRED(!cs) { LOCK(cs); return std::make_unique(*this); @@ -61,28 +61,28 @@ public: } template - bool Read(const K& key, V& value) LOCKS_EXCLUDED(cs) + bool Read(const K& key, V& value) EXCLUSIVE_LOCKS_REQUIRED(!cs) { LOCK(cs); return curDBTransaction.Read(key, value); } template - void Write(const K& key, const V& value) LOCKS_EXCLUDED(cs) + void Write(const K& key, const V& value) EXCLUSIVE_LOCKS_REQUIRED(!cs) { LOCK(cs); curDBTransaction.Write(key, value); } template - bool Exists(const K& key) LOCKS_EXCLUDED(cs) + bool Exists(const K& key) EXCLUSIVE_LOCKS_REQUIRED(!cs) { LOCK(cs); return curDBTransaction.Exists(key); } template - void Erase(const K& key) LOCKS_EXCLUDED(cs) + void Erase(const K& key) EXCLUSIVE_LOCKS_REQUIRED(!cs) { LOCK(cs); curDBTransaction.Erase(key); @@ -98,18 +98,18 @@ public: return rootDBTransaction.GetMemoryUsage(); } - bool CommitRootTransaction() LOCKS_EXCLUDED(cs); + bool CommitRootTransaction() EXCLUSIVE_LOCKS_REQUIRED(!cs); bool IsEmpty() { return db.IsEmpty(); } - bool VerifyBestBlock(const uint256& hash); - void WriteBestBlock(const uint256& hash); + bool VerifyBestBlock(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(!cs); + void WriteBestBlock(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(!cs); private: // only CEvoDBScopedCommitter is allowed to invoke these friend class CEvoDBScopedCommitter; - void CommitCurTransaction() LOCKS_EXCLUDED(cs); - void RollbackCurTransaction() LOCKS_EXCLUDED(cs); + void CommitCurTransaction() EXCLUSIVE_LOCKS_REQUIRED(!cs); + void RollbackCurTransaction() EXCLUSIVE_LOCKS_REQUIRED(!cs); }; #endif // BITCOIN_EVO_EVODB_H diff --git a/src/evo/mnhftx.h b/src/evo/mnhftx.h index b09cc35594..63d8f07cca 100644 --- a/src/evo/mnhftx.h +++ b/src/evo/mnhftx.h @@ -128,7 +128,7 @@ public: /** * Helper that used in Unit Test to forcely setup EHF signal for specific block */ - void AddSignal(const CBlockIndex* const pindex, int bit) LOCKS_EXCLUDED(cs_cache); + void AddSignal(const CBlockIndex* const pindex, int bit) EXCLUSIVE_LOCKS_REQUIRED(!cs_cache); private: void AddToCache(const Signals& signals, const CBlockIndex* const pindex); diff --git a/src/llmq/chainlocks.h b/src/llmq/chainlocks.h index 29818ff1c4..a21cc342e7 100644 --- a/src/llmq/chainlocks.h +++ b/src/llmq/chainlocks.h @@ -95,37 +95,37 @@ public: void Start(); void Stop(); - bool AlreadyHave(const CInv& inv) const LOCKS_EXCLUDED(cs); - bool GetChainLockByHash(const uint256& hash, CChainLockSig& ret) const LOCKS_EXCLUDED(cs); - CChainLockSig GetBestChainLock() const LOCKS_EXCLUDED(cs); + bool AlreadyHave(const CInv& inv) const EXCLUSIVE_LOCKS_REQUIRED(!cs); + bool GetChainLockByHash(const uint256& hash, CChainLockSig& ret) const EXCLUSIVE_LOCKS_REQUIRED(!cs); + CChainLockSig GetBestChainLock() const EXCLUSIVE_LOCKS_REQUIRED(!cs); - PeerMsgRet ProcessMessage(const CNode& pfrom, const std::string& msg_type, CDataStream& vRecv); - PeerMsgRet ProcessNewChainLock(NodeId from, const CChainLockSig& clsig, const uint256& hash) LOCKS_EXCLUDED(cs); + PeerMsgRet ProcessMessage(const CNode& pfrom, const std::string& msg_type, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs); + PeerMsgRet ProcessNewChainLock(NodeId from, const CChainLockSig& clsig, const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(!cs); - void AcceptedBlockHeader(gsl::not_null pindexNew) LOCKS_EXCLUDED(cs); + void AcceptedBlockHeader(gsl::not_null pindexNew) EXCLUSIVE_LOCKS_REQUIRED(!cs); void UpdatedBlockTip(); - void TransactionAddedToMempool(const CTransactionRef& tx, int64_t nAcceptTime) LOCKS_EXCLUDED(cs); - void BlockConnected(const std::shared_ptr& pblock, gsl::not_null pindex) LOCKS_EXCLUDED(cs); - void BlockDisconnected(const std::shared_ptr& pblock, gsl::not_null pindexDisconnected) LOCKS_EXCLUDED(cs); - void CheckActiveState() LOCKS_EXCLUDED(cs); - void TrySignChainTip() LOCKS_EXCLUDED(cs); - void EnforceBestChainLock() LOCKS_EXCLUDED(cs); - void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override LOCKS_EXCLUDED(cs); + void TransactionAddedToMempool(const CTransactionRef& tx, int64_t nAcceptTime) EXCLUSIVE_LOCKS_REQUIRED(!cs); + void BlockConnected(const std::shared_ptr& pblock, gsl::not_null pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs); + void BlockDisconnected(const std::shared_ptr& pblock, gsl::not_null pindexDisconnected) EXCLUSIVE_LOCKS_REQUIRED(!cs); + void CheckActiveState() EXCLUSIVE_LOCKS_REQUIRED(!cs); + void TrySignChainTip() EXCLUSIVE_LOCKS_REQUIRED(!cs); + void EnforceBestChainLock() EXCLUSIVE_LOCKS_REQUIRED(!cs); + void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override EXCLUSIVE_LOCKS_REQUIRED(!cs); - bool HasChainLock(int nHeight, const uint256& blockHash) const LOCKS_EXCLUDED(cs); - bool HasConflictingChainLock(int nHeight, const uint256& blockHash) const LOCKS_EXCLUDED(cs); + bool HasChainLock(int nHeight, const uint256& blockHash) const EXCLUSIVE_LOCKS_REQUIRED(!cs); + bool HasConflictingChainLock(int nHeight, const uint256& blockHash) const EXCLUSIVE_LOCKS_REQUIRED(!cs); bool VerifyChainLock(const CChainLockSig& clsig) const; - bool IsTxSafeForMining(const uint256& txid) const LOCKS_EXCLUDED(cs); + bool IsTxSafeForMining(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(!cs); private: // these require locks to be held already bool InternalHasChainLock(int nHeight, const uint256& blockHash) const EXCLUSIVE_LOCKS_REQUIRED(cs); bool InternalHasConflictingChainLock(int nHeight, const uint256& blockHash) const EXCLUSIVE_LOCKS_REQUIRED(cs); - BlockTxs::mapped_type GetBlockTxs(const uint256& blockHash) LOCKS_EXCLUDED(cs); + BlockTxs::mapped_type GetBlockTxs(const uint256& blockHash) EXCLUSIVE_LOCKS_REQUIRED(!cs); - void Cleanup() LOCKS_EXCLUDED(cs); + void Cleanup() EXCLUSIVE_LOCKS_REQUIRED(!cs); }; extern std::unique_ptr chainLocksHandler; diff --git a/src/llmq/ehf_signals.h b/src/llmq/ehf_signals.h index b93474f2d2..3629ce2873 100644 --- a/src/llmq/ehf_signals.h +++ b/src/llmq/ehf_signals.h @@ -49,12 +49,12 @@ public: /** * Since Tip is updated it could be a time to generate EHF Signal */ - void UpdatedBlockTip(const CBlockIndex* const pindexNew, bool is_masternode); + void UpdatedBlockTip(const CBlockIndex* const pindexNew, bool is_masternode) EXCLUSIVE_LOCKS_REQUIRED(!cs); - void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override LOCKS_EXCLUDED(cs); + void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override EXCLUSIVE_LOCKS_REQUIRED(!cs); private: - void trySignEHFSignal(int bit, const CBlockIndex* const pindex) LOCKS_EXCLUDED(cs); + void trySignEHFSignal(int bit, const CBlockIndex* const pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs); }; diff --git a/src/llmq/instantsend.h b/src/llmq/instantsend.h index 5244e3d64c..733d2afd7a 100644 --- a/src/llmq/instantsend.h +++ b/src/llmq/instantsend.h @@ -116,46 +116,46 @@ public: explicit CInstantSendDb(bool unitTests, bool fWipe); ~CInstantSendDb(); - void Upgrade(const CTxMemPool& mempool) LOCKS_EXCLUDED(cs_db); + void Upgrade(const CTxMemPool& mempool) EXCLUSIVE_LOCKS_REQUIRED(!cs_db); /** * This method is called when an InstantSend Lock is processed and adds the lock to the database * @param hash The hash of the InstantSend Lock * @param islock The InstantSend Lock object itself */ - void WriteNewInstantSendLock(const uint256& hash, const CInstantSendLock& islock) LOCKS_EXCLUDED(cs_db); + void WriteNewInstantSendLock(const uint256& hash, const CInstantSendLock& islock) EXCLUSIVE_LOCKS_REQUIRED(!cs_db); /** * This method updates a DB entry for an InstantSend Lock from being not included in a block to being included in a block * @param hash The hash of the InstantSend Lock * @param nHeight The height that the transaction was included at */ - void WriteInstantSendLockMined(const uint256& hash, int nHeight) LOCKS_EXCLUDED(cs_db); + void WriteInstantSendLockMined(const uint256& hash, int nHeight) EXCLUSIVE_LOCKS_REQUIRED(!cs_db); /** * Archives and deletes all IS Locks which were mined into a block before nUntilHeight * @param nUntilHeight Removes all IS Locks confirmed up until nUntilHeight * @return returns an unordered_map of the hash of the IS Locks and a pointer object to the IS Locks for all IS Locks which were removed */ - std::unordered_map RemoveConfirmedInstantSendLocks(int nUntilHeight) LOCKS_EXCLUDED(cs_db); + std::unordered_map RemoveConfirmedInstantSendLocks(int nUntilHeight) EXCLUSIVE_LOCKS_REQUIRED(!cs_db); /** * Removes IS Locks from the archive if the tx was confirmed 100 blocks before nUntilHeight * @param nUntilHeight the height from which to base the remove of archive IS Locks */ - void RemoveArchivedInstantSendLocks(int nUntilHeight) LOCKS_EXCLUDED(cs_db); - void WriteBlockInstantSendLocks(const gsl::not_null>& pblock, gsl::not_null pindexConnected) LOCKS_EXCLUDED(cs_db); - void RemoveBlockInstantSendLocks(const gsl::not_null>& pblock, gsl::not_null pindexDisconnected) LOCKS_EXCLUDED(cs_db); - bool KnownInstantSendLock(const uint256& islockHash) const LOCKS_EXCLUDED(cs_db); + void RemoveArchivedInstantSendLocks(int nUntilHeight) EXCLUSIVE_LOCKS_REQUIRED(!cs_db); + void WriteBlockInstantSendLocks(const gsl::not_null>& pblock, gsl::not_null pindexConnected) EXCLUSIVE_LOCKS_REQUIRED(!cs_db); + void RemoveBlockInstantSendLocks(const gsl::not_null>& pblock, gsl::not_null pindexDisconnected) EXCLUSIVE_LOCKS_REQUIRED(!cs_db); + bool KnownInstantSendLock(const uint256& islockHash) const EXCLUSIVE_LOCKS_REQUIRED(!cs_db); /** * Gets the number of IS Locks which have not been confirmed by a block * @return size_t value of the number of IS Locks not confirmed by a block */ - size_t GetInstantSendLockCount() const LOCKS_EXCLUDED(cs_db); + size_t GetInstantSendLockCount() const EXCLUSIVE_LOCKS_REQUIRED(!cs_db); /** * Gets a pointer to the IS Lock based on the hash * @param hash The hash of the IS Lock * @param use_cache Should we try using the cache first or not * @return A Pointer object to the IS Lock, returns nullptr if it doesn't exist */ - CInstantSendLockPtr GetInstantSendLockByHash(const uint256& hash, bool use_cache = true) const LOCKS_EXCLUDED(cs_db) + CInstantSendLockPtr GetInstantSendLockByHash(const uint256& hash, bool use_cache = true) const EXCLUSIVE_LOCKS_REQUIRED(!cs_db) { LOCK(cs_db); return GetInstantSendLockByHashInternal(hash, use_cache); @@ -165,7 +165,7 @@ public: * @param txid The txid which is being searched for * @return Returns the hash the IS Lock of the specified txid, returns uint256() if it doesn't exist */ - uint256 GetInstantSendLockHashByTxid(const uint256& txid) const LOCKS_EXCLUDED(cs_db) + uint256 GetInstantSendLockHashByTxid(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(!cs_db) { LOCK(cs_db); return GetInstantSendLockHashByTxidInternal(txid); @@ -175,13 +175,13 @@ public: * @param txid The txid for which the IS Lock Pointer is being returned * @return Returns the IS Lock Pointer associated with the txid, returns nullptr if it doesn't exist */ - CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid) const LOCKS_EXCLUDED(cs_db); + CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(!cs_db); /** * Gets an IS Lock pointer from an input given * @param outpoint Since all inputs are really just outpoints that are being spent * @return IS Lock Pointer associated with that input. */ - CInstantSendLockPtr GetInstantSendLockByInput(const COutPoint& outpoint) const LOCKS_EXCLUDED(cs_db); + CInstantSendLockPtr GetInstantSendLockByInput(const COutPoint& outpoint) const EXCLUSIVE_LOCKS_REQUIRED(!cs_db); /** * Called when a ChainLock invalidated a IS Lock, removes any chained/children IS Locks and the invalidated IS Lock * @param islockHash IS Lock hash which has been invalidated @@ -189,7 +189,7 @@ public: * @param nHeight height of the block which received a chainlock and invalidated the IS Lock * @return A vector of IS Lock hashes of all IS Locks removed */ - std::vector RemoveChainedInstantSendLocks(const uint256& islockHash, const uint256& txid, int nHeight) LOCKS_EXCLUDED(cs_db); + std::vector RemoveChainedInstantSendLocks(const uint256& islockHash, const uint256& txid, int nHeight) EXCLUSIVE_LOCKS_REQUIRED(!cs_db); }; class CInstantSendManager : public CRecoveredSigsListener @@ -273,61 +273,85 @@ public: void InterruptWorkerThread() { workInterrupt(); }; private: - void ProcessTx(const CTransaction& tx, bool fRetroactive, const Consensus::Params& params); + void ProcessTx(const CTransaction& tx, bool fRetroactive, const Consensus::Params& params) + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests); bool CheckCanLock(const CTransaction& tx, bool printDebug, const Consensus::Params& params) const; - bool CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, const Consensus::Params& params) const; + bool CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, + const Consensus::Params& params) const; - void HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid); - void HandleNewInstantSendLockRecoveredSig(const CRecoveredSig& recoveredSig) LOCKS_EXCLUDED(cs_creating, cs_pendingLocks); + void HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid) + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating); + void HandleNewInstantSendLockRecoveredSig(const CRecoveredSig& recoveredSig) + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_pendingLocks); - bool TrySignInputLocks(const CTransaction& tx, bool allowResigning, Consensus::LLMQType llmqType, const Consensus::Params& params) LOCKS_EXCLUDED(cs_inputReqests); - void TrySignInstantSendLock(const CTransaction& tx) LOCKS_EXCLUDED(cs_creating); + bool TrySignInputLocks(const CTransaction& tx, bool allowResigning, Consensus::LLMQType llmqType, + const Consensus::Params& params) EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests); + void TrySignInstantSendLock(const CTransaction& tx) EXCLUSIVE_LOCKS_REQUIRED(!cs_creating); PeerMsgRet ProcessMessageInstantSendLock(const CNode& pfrom, const CInstantSendLockPtr& islock); - bool ProcessPendingInstantSendLocks() LOCKS_EXCLUDED(cs_pendingLocks); + bool ProcessPendingInstantSendLocks() + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_nonLocked, !cs_pendingLocks, !cs_pendingRetry); std::unordered_set ProcessPendingInstantSendLocks(const Consensus::LLMQParams& llmq_params, int signOffset, const std::unordered_map, StaticSaltedHasher>& pend, - bool ban) LOCKS_EXCLUDED(cs_pendingLocks); - void ProcessInstantSendLock(NodeId from, const uint256& hash, const CInstantSendLockPtr& islock) LOCKS_EXCLUDED(cs_creating, cs_pendingLocks); + bool ban) + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_nonLocked, !cs_pendingLocks, !cs_pendingRetry); + void ProcessInstantSendLock(NodeId from, const uint256& hash, const CInstantSendLockPtr& islock) + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_nonLocked, !cs_pendingLocks, !cs_pendingRetry); - void AddNonLockedTx(const CTransactionRef& tx, const CBlockIndex* pindexMined) LOCKS_EXCLUDED(cs_pendingLocks, cs_nonLocked); - void RemoveNonLockedTx(const uint256& txid, bool retryChildren) LOCKS_EXCLUDED(cs_nonLocked, cs_pendingRetry); - void RemoveConflictedTx(const CTransaction& tx) LOCKS_EXCLUDED(cs_inputReqests); - void TruncateRecoveredSigsForInputs(const CInstantSendLock& islock) LOCKS_EXCLUDED(cs_inputReqests); + void AddNonLockedTx(const CTransactionRef& tx, const CBlockIndex* pindexMined) + EXCLUSIVE_LOCKS_REQUIRED(!cs_nonLocked, !cs_pendingLocks); + void RemoveNonLockedTx(const uint256& txid, bool retryChildren) + EXCLUSIVE_LOCKS_REQUIRED(!cs_nonLocked, !cs_pendingRetry); + void RemoveConflictedTx(const CTransaction& tx) + EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests, !cs_nonLocked, !cs_pendingRetry); + void TruncateRecoveredSigsForInputs(const CInstantSendLock& islock) + EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests); - void RemoveMempoolConflictsForLock(const uint256& hash, const CInstantSendLock& islock); - void ResolveBlockConflicts(const uint256& islockHash, const CInstantSendLock& islock) LOCKS_EXCLUDED(cs_pendingLocks, cs_nonLocked); - static void AskNodesForLockedTx(const uint256& txid, const CConnman& connman, const PeerManager& peerman, bool is_masternode); - void ProcessPendingRetryLockTxs() LOCKS_EXCLUDED(cs_creating, cs_nonLocked, cs_pendingRetry); + void RemoveMempoolConflictsForLock(const uint256& hash, const CInstantSendLock& islock) + EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests, !cs_nonLocked, !cs_pendingRetry); + void ResolveBlockConflicts(const uint256& islockHash, const CInstantSendLock& islock) + EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests, !cs_nonLocked, !cs_pendingLocks, !cs_pendingRetry); + static void AskNodesForLockedTx(const uint256& txid, const CConnman& connman, const PeerManager& peerman, + bool is_masternode); + void ProcessPendingRetryLockTxs() + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_nonLocked, !cs_pendingRetry); - void WorkThreadMain(); + void WorkThreadMain() + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_nonLocked, !cs_pendingLocks, !cs_pendingRetry); - void HandleFullyConfirmedBlock(const CBlockIndex* pindex) LOCKS_EXCLUDED(cs_nonLocked); + void HandleFullyConfirmedBlock(const CBlockIndex* pindex) + EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests, !cs_nonLocked, !cs_pendingRetry); public: bool IsLocked(const uint256& txHash) const; - bool IsWaitingForTx(const uint256& txHash) const LOCKS_EXCLUDED(cs_pendingLocks); + bool IsWaitingForTx(const uint256& txHash) const EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingLocks); CInstantSendLockPtr GetConflictingLock(const CTransaction& tx) const; - void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override LOCKS_EXCLUDED(cs_inputReqests, cs_creating); + void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_pendingLocks); PeerMsgRet ProcessMessage(const CNode& pfrom, std::string_view msg_type, CDataStream& vRecv); - void TransactionAddedToMempool(const CTransactionRef& tx) LOCKS_EXCLUDED(cs_pendingLocks); + void TransactionAddedToMempool(const CTransactionRef& tx) + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_nonLocked, !cs_pendingLocks, !cs_pendingRetry); void TransactionRemovedFromMempool(const CTransactionRef& tx); - void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindex); + void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindex) + EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_nonLocked, !cs_pendingLocks, !cs_pendingRetry); void BlockDisconnected(const std::shared_ptr& pblock, const CBlockIndex* pindexDisconnected); - bool AlreadyHave(const CInv& inv) const LOCKS_EXCLUDED(cs_pendingLocks); - bool GetInstantSendLockByHash(const uint256& hash, CInstantSendLock& ret) const LOCKS_EXCLUDED(cs_pendingLocks); + bool AlreadyHave(const CInv& inv) const EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingLocks); + bool GetInstantSendLockByHash(const uint256& hash, CInstantSendLock& ret) const + EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingLocks); CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid) const; - void NotifyChainLock(const CBlockIndex* pindexChainLock); - void UpdatedBlockTip(const CBlockIndex* pindexNew); + void NotifyChainLock(const CBlockIndex* pindexChainLock) + EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests, !cs_nonLocked, !cs_pendingRetry); + void UpdatedBlockTip(const CBlockIndex* pindexNew) + EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests, !cs_nonLocked, !cs_pendingRetry); void RemoveConflictingLock(const uint256& islockHash, const CInstantSendLock& islock); diff --git a/src/masternode/node.h b/src/masternode/node.h index d63e14b5d9..738b6a7ac9 100644 --- a/src/masternode/node.h +++ b/src/masternode/node.h @@ -53,9 +53,10 @@ private: public: explicit CActiveMasternodeManager(const CBLSSecretKey& sk, CConnman& connman, const std::unique_ptr& dmnman); - void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override; + void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override + EXCLUSIVE_LOCKS_REQUIRED(!cs); - void Init(const CBlockIndex* pindex) LOCKS_EXCLUDED(cs) { LOCK(cs); InitInternal(pindex); }; + void Init(const CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs) { LOCK(cs); InitInternal(pindex); }; std::string GetStateString() const; std::string GetStatus() const; @@ -64,9 +65,9 @@ public: template