aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-06 16:58:53 +0200
committerMacroFake <falke.marco@gmail.com>2022-08-16 17:26:40 +0200
commitfac04cb6ba1d032587bd02eab2247fd655a548cd (patch)
treebe6149a2a37ee881bccb119e08a1260a237d4a99 /src/validation.h
parentfac15ff673f0d6f84ea1eaae855597da02b0e510 (diff)
downloadbitcoin-fac04cb6ba1d032587bd02eab2247fd655a548cd.tar.xz
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.
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/validation.h b/src/validation.h
index 856370d5b4..324074aee9 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -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)
{