aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-03-01 17:06:51 -0500
committerCarl Dong <contact@carldong.me>2021-03-03 14:56:26 -0500
commite11b6496506246882df450586acf735dabedf731 (patch)
treee5d503e5cd488b1d33c53f0227ed625d89709485 /src
parent03f75c42e12a272057adccb6f0077e71f971eeef (diff)
validation: CVerifyDB::VerifyDB: Use locking annotation
...instead of recursively locking unconditionally
Diffstat (limited to 'src')
-rw-r--r--src/validation.cpp3
-rw-r--r--src/validation.h2
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