mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
masternode: replace LOCKS_EXCLUDED
with negative EXCLUSIVE_LOCKS_REQUIRED
This commit is contained in:
parent
8b1d3b55ab
commit
d657951f90
@ -603,21 +603,21 @@ public:
|
||||
~CDeterministicMNManager() = default;
|
||||
|
||||
bool ProcessBlock(const CBlock& block, gsl::not_null<const CBlockIndex*> pindex, BlockValidationState& state,
|
||||
const CCoinsViewCache& view, bool fJustCheck, std::optional<MNListUpdates>& updatesRet) EXCLUSIVE_LOCKS_REQUIRED(cs_main) LOCKS_EXCLUDED(cs);
|
||||
bool UndoBlock(gsl::not_null<const CBlockIndex*> pindex, std::optional<MNListUpdates>& updatesRet) LOCKS_EXCLUDED(cs);
|
||||
const CCoinsViewCache& view, bool fJustCheck, std::optional<MNListUpdates>& updatesRet) EXCLUSIVE_LOCKS_REQUIRED(!cs, cs_main);
|
||||
bool UndoBlock(gsl::not_null<const CBlockIndex*> pindex, std::optional<MNListUpdates>& updatesRet) EXCLUSIVE_LOCKS_REQUIRED(!cs);
|
||||
|
||||
void UpdatedBlockTip(gsl::not_null<const CBlockIndex*> pindex) LOCKS_EXCLUDED(cs);
|
||||
void UpdatedBlockTip(gsl::not_null<const CBlockIndex*> 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<const CBlockIndex*> 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<const CBlockIndex*> pQuorumBaseBlockIndex, CDeterministicMNList& mnList, bool debugLogs);
|
||||
|
||||
CDeterministicMNList GetListForBlock(gsl::not_null<const CBlockIndex*> pindex) LOCKS_EXCLUDED(cs) {
|
||||
CDeterministicMNList GetListForBlock(gsl::not_null<const CBlockIndex*> 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);
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
public:
|
||||
explicit CEvoDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
||||
|
||||
std::unique_ptr<CEvoDBScopedCommitter> BeginTransaction() LOCKS_EXCLUDED(cs)
|
||||
std::unique_ptr<CEvoDBScopedCommitter> BeginTransaction() EXCLUSIVE_LOCKS_REQUIRED(!cs)
|
||||
{
|
||||
LOCK(cs);
|
||||
return std::make_unique<CEvoDBScopedCommitter>(*this);
|
||||
@ -61,28 +61,28 @@ public:
|
||||
}
|
||||
|
||||
template <typename K, typename V>
|
||||
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 <typename K, typename V>
|
||||
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 <typename K>
|
||||
bool Exists(const K& key) LOCKS_EXCLUDED(cs)
|
||||
bool Exists(const K& key) EXCLUSIVE_LOCKS_REQUIRED(!cs)
|
||||
{
|
||||
LOCK(cs);
|
||||
return curDBTransaction.Exists(key);
|
||||
}
|
||||
|
||||
template <typename K>
|
||||
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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -53,9 +53,10 @@ private:
|
||||
public:
|
||||
explicit CActiveMasternodeManager(const CBLSSecretKey& sk, CConnman& connman, const std::unique_ptr<CDeterministicMNManager>& 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 <template <typename> class EncryptedObj, typename Obj>
|
||||
[[nodiscard]] bool Decrypt(const EncryptedObj<Obj>& obj, size_t idx, Obj& ret_obj, int version) const
|
||||
LOCKS_EXCLUDED(cs);
|
||||
[[nodiscard]] CBLSSignature Sign(const uint256& hash) const LOCKS_EXCLUDED(cs);
|
||||
[[nodiscard]] CBLSSignature Sign(const uint256& hash, const bool is_legacy) const LOCKS_EXCLUDED(cs);
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!cs);
|
||||
[[nodiscard]] CBLSSignature Sign(const uint256& hash) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
|
||||
[[nodiscard]] CBLSSignature Sign(const uint256& hash, const bool is_legacy) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
|
||||
|
||||
/* TODO: Reconsider external locking */
|
||||
[[nodiscard]] COutPoint GetOutPoint() const { READ_LOCK(cs); return m_info.outpoint; }
|
||||
|
Loading…
Reference in New Issue
Block a user