diff options
author | Carl Dong <contact@carldong.me> | 2021-01-27 16:20:59 -0500 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2021-02-01 22:09:03 -0500 |
commit | 20677ffa22e93e7408daadbd15d433f1e42faa86 (patch) | |
tree | 90024cf871094423c026119029a76e545dcdb06b /src/validation.h | |
parent | f72d80b07af8ecbb2f9df1e87344eb465186f19d (diff) | |
download | bitcoin-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.h | 4 |
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. |