diff options
author | Jon Atack <jon@atack.com> | 2022-01-27 12:37:50 +0100 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2022-02-09 19:13:50 +0100 |
commit | f485a0745455b46390f1c14260643ad69c8fe2ad (patch) | |
tree | 3b5344b1213a0e1f40d702552873b2aa9728dc04 | |
parent | 37af8a20cf39ed8ee4b3ba4e1d8d55178eaacb78 (diff) |
Add missing thread safety lock assertions in validation.h
-rw-r--r-- | src/validation.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/validation.h b/src/validation.h index fdfd29d1f8..968f62aa9a 100644 --- a/src/validation.h +++ b/src/validation.h @@ -529,7 +529,9 @@ public: //! @returns whether or not the CoinsViews object has been fully initialized and we can //! safely flush this object to disk. - bool CanFlushToDisk() const EXCLUSIVE_LOCKS_REQUIRED(cs_main) { + bool CanFlushToDisk() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main) + { + AssertLockHeld(::cs_main); return m_coins_views && m_coins_views->m_cacheview; } @@ -557,15 +559,17 @@ public: std::set<CBlockIndex*, node::CBlockIndexWorkComparator> setBlockIndexCandidates; //! @returns A reference to the in-memory cache of the UTXO set. - CCoinsViewCache& CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(cs_main) + CCoinsViewCache& CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { + AssertLockHeld(::cs_main); assert(m_coins_views->m_cacheview); return *m_coins_views->m_cacheview.get(); } //! @returns A reference to the on-disk UTXO set database. - CCoinsViewDB& CoinsDB() EXCLUSIVE_LOCKS_REQUIRED(cs_main) + CCoinsViewDB& CoinsDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { + AssertLockHeld(::cs_main); return m_coins_views->m_dbview; } @@ -577,8 +581,9 @@ public: //! @returns A reference to a wrapped view of the in-memory UTXO set that //! handles disk read errors gracefully. - CCoinsViewErrorCatcher& CoinsErrorCatcher() EXCLUSIVE_LOCKS_REQUIRED(cs_main) + CCoinsViewErrorCatcher& CoinsErrorCatcher() EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { + AssertLockHeld(::cs_main); return m_coins_views->m_catcherview; } @@ -924,6 +929,7 @@ public: node::BlockMap& BlockIndex() EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { + AssertLockHeld(::cs_main); return m_blockman.m_block_index; } |