mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
refactor: Add lock annotations to Active* methods
This is a refactor, putting the burden to think about thread safety to the caller. Otherwise, there is a risk that the caller will assume thread safety where none exists, as is evident in the previous two commits.
This commit is contained in:
@@ -951,9 +951,9 @@ public:
|
||||
|
||||
//! The most-work chain.
|
||||
CChainState& ActiveChainstate() const;
|
||||
CChain& ActiveChain() const { return ActiveChainstate().m_chain; }
|
||||
int ActiveHeight() const { return ActiveChain().Height(); }
|
||||
CBlockIndex* ActiveTip() const { return ActiveChain().Tip(); }
|
||||
CChain& ActiveChain() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { return ActiveChainstate().m_chain; }
|
||||
int ActiveHeight() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { return ActiveChain().Height(); }
|
||||
CBlockIndex* ActiveTip() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) { return ActiveChain().Tip(); }
|
||||
|
||||
node::BlockMap& BlockIndex() EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user