aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-01-27 16:20:59 -0500
committerCarl Dong <contact@carldong.me>2021-02-01 22:09:03 -0500
commit20677ffa22e93e7408daadbd15d433f1e42faa86 (patch)
tree90024cf871094423c026119029a76e545dcdb06b /src/validation.h
parentf72d80b07af8ecbb2f9df1e87344eb465186f19d (diff)
downloadbitcoin-20677ffa22e93e7408daadbd15d433f1e42faa86.tar.xz
validation: Guard all chainstates with cs_main
Since these chainstates are: 1. Also vulnerable to the race condition described in the previous commit 2. Documented as having similar semantics as m_active_chainstate we should also protect them with ::cs_main.
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/validation.h b/src/validation.h
index fc7add85b7..e85c7bbf1a 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -802,7 +802,7 @@ private:
//! This is especially important when, e.g., calling ActivateBestChain()
//! on all chainstates because we are not able to hold ::cs_main going into
//! that call.
- std::unique_ptr<CChainState> m_ibd_chainstate;
+ std::unique_ptr<CChainState> m_ibd_chainstate GUARDED_BY(::cs_main);
//! A chainstate initialized on the basis of a UTXO snapshot. If this is
//! non-null, it is always our active chainstate.
@@ -815,7 +815,7 @@ private:
//! This is especially important when, e.g., calling ActivateBestChain()
//! on all chainstates because we are not able to hold ::cs_main going into
//! that call.
- std::unique_ptr<CChainState> m_snapshot_chainstate;
+ std::unique_ptr<CChainState> m_snapshot_chainstate GUARDED_BY(::cs_main);
//! Points to either the ibd or snapshot chainstate; indicates our
//! most-work chain.