spork: replace LOCKS_EXCLUDED with negative EXCLUSIVE_LOCKS_REQUIRED

This commit is contained in:
Kittywhiskers Van Gogh 2024-04-30 10:42:04 +00:00
parent d657951f90
commit 0bba55f6af
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -171,7 +171,7 @@ protected:
public:
template<typename Stream>
void Serialize(Stream &s) const LOCKS_EXCLUDED(cs)
void Serialize(Stream &s) const EXCLUSIVE_LOCKS_REQUIRED(!cs)
{
// We don't serialize pubkey ids because pubkeys should be
// hardcoded or be set with cmdline or options, should
@ -182,7 +182,7 @@ public:
}
template<typename Stream>
void Unserialize(Stream &s) LOCKS_EXCLUDED(cs)
void Unserialize(Stream &s) EXCLUSIVE_LOCKS_REQUIRED(!cs)
{
LOCK(cs);
std::string strVersion;
@ -199,12 +199,12 @@ public:
*
* This method was introduced along with the spork cache.
*/
void Clear() LOCKS_EXCLUDED(cs);
void Clear() EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* ToString returns the string representation of the SporkManager.
*/
std::string ToString() const LOCKS_EXCLUDED(cs);
std::string ToString() const EXCLUSIVE_LOCKS_REQUIRED(!cs);
};
/**
@ -253,7 +253,7 @@ public:
*
* This method was introduced along with the spork cache.
*/
void CheckAndRemove() LOCKS_EXCLUDED(cs);
void CheckAndRemove() EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* ProcessMessage is used to call ProcessSpork and ProcessGetSporks. See below
@ -266,20 +266,20 @@ public:
* For 'spork', it validates the spork and adds it to the internal spork storage and
* performs any necessary processing.
*/
PeerMsgRet ProcessSpork(const CNode& peer, PeerManager& peerman, CDataStream& vRecv) LOCKS_EXCLUDED(cs);
PeerMsgRet ProcessSpork(const CNode& peer, PeerManager& peerman, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* ProcessGetSporks is used to handle the 'getsporks' p2p message.
*
* For 'getsporks', it sends active sporks to the requesting peer.
*/
void ProcessGetSporks(CNode& peer, CConnman& connman) LOCKS_EXCLUDED(cs);
void ProcessGetSporks(CNode& peer, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* UpdateSpork is used by the spork RPC command to set a new spork value, sign
* and broadcast the spork message.
*/
bool UpdateSpork(PeerManager& peerman, SporkId nSporkID, SporkValue nValue) LOCKS_EXCLUDED(cs);
bool UpdateSpork(PeerManager& peerman, SporkId nSporkID, SporkValue nValue) EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* IsSporkActive returns a bool for time-based sporks, and should be used
@ -295,7 +295,7 @@ public:
* GetSporkValue returns the spork value given a Spork ID. If no active spork
* message has yet been received by the node, it returns the default value.
*/
SporkValue GetSporkValue(SporkId nSporkID) const LOCKS_EXCLUDED(cs);
SporkValue GetSporkValue(SporkId nSporkID) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* GetSporkIDByName returns the internal Spork ID given the spork name.
@ -310,7 +310,7 @@ public:
* hash-based index of sporks for this reason, and this function is the access
* point into that index.
*/
std::optional<CSporkMessage> GetSporkByHash(const uint256& hash) const LOCKS_EXCLUDED(cs);
std::optional<CSporkMessage> GetSporkByHash(const uint256& hash) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* SetSporkAddress is used to set a public key ID which will be used to
@ -319,7 +319,7 @@ public:
* This can be called multiple times to add multiple keys to the set of
* valid spork signers.
*/
bool SetSporkAddress(const std::string& strAddress) LOCKS_EXCLUDED(cs);
bool SetSporkAddress(const std::string& strAddress) EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* SetMinSporkKeys is used to set the required spork signer threshold, for
@ -328,7 +328,7 @@ public:
* This value must be at least a majority of the total number of spork
* keys, and for obvious reasons cannot be larger than that number.
*/
bool SetMinSporkKeys(int minSporkKeys) LOCKS_EXCLUDED(cs);
bool SetMinSporkKeys(int minSporkKeys) EXCLUSIVE_LOCKS_REQUIRED(!cs);
/**
* SetPrivKey is used to set a spork key to enable setting / signing of
@ -337,7 +337,7 @@ public:
* This will return false if the private key does not match any spork
* address in the set of valid spork signers (see SetSporkAddress).
*/
bool SetPrivKey(const std::string& strPrivKey) LOCKS_EXCLUDED(cs);
bool SetPrivKey(const std::string& strPrivKey) EXCLUSIVE_LOCKS_REQUIRED(!cs);
};
#endif // BITCOIN_SPORK_H