diff options
author | Carl Dong <contact@carldong.me> | 2021-03-01 17:06:51 -0500 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2021-03-03 14:56:26 -0500 |
commit | e11b6496506246882df450586acf735dabedf731 (patch) | |
tree | e5d503e5cd488b1d33c53f0227ed625d89709485 | |
parent | 03f75c42e12a272057adccb6f0077e71f971eeef (diff) | |
download | bitcoin-e11b6496506246882df450586acf735dabedf731.tar.xz |
validation: CVerifyDB::VerifyDB: Use locking annotation
...instead of recursively locking unconditionally
-rw-r--r-- | src/validation.cpp | 3 | ||||
-rw-r--r-- | src/validation.h | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index e1cd97a38e..e7439a2a1a 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4245,7 +4245,8 @@ CVerifyDB::~CVerifyDB() bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CChainState& active_chainstate, CCoinsView *coinsview, int nCheckLevel, int nCheckDepth) { - LOCK(cs_main); + AssertLockHeld(cs_main); + assert(std::addressof(::ChainstateActive()) == std::addressof(active_chainstate)); if (active_chainstate.m_chain.Tip() == nullptr || active_chainstate.m_chain.Tip()->pprev == nullptr) return true; diff --git a/src/validation.h b/src/validation.h index ff6bac4c43..74f8541934 100644 --- a/src/validation.h +++ b/src/validation.h @@ -340,7 +340,7 @@ class CVerifyDB { public: CVerifyDB(); ~CVerifyDB(); - bool VerifyDB(const CChainParams& chainparams, CChainState& active_chainstate, CCoinsView *coinsview, int nCheckLevel, int nCheckDepth); + bool VerifyDB(const CChainParams& chainparams, CChainState& active_chainstate, CCoinsView *coinsview, int nCheckLevel, int nCheckDepth) EXCLUSIVE_LOCKS_REQUIRED(cs_main); }; enum DisconnectResult |