aboutsummaryrefslogtreecommitdiff
path: root/src/versionbits.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2020-12-29 22:43:18 +1000
committerAnthony Towns <aj@erisian.com.au>2021-06-29 17:11:12 +1000
commiteccd736f3dc231ac0306ca763c3b72cf8247230a (patch)
tree3d9a5aaeaec55e5942a66f2523e0564d52b6f2d5 /src/versionbits.cpp
parent36a4ba0aaaa9b35185d7178994e36bc02cca9887 (diff)
versionbits: Use dedicated lock instead of cs_main
Diffstat (limited to 'src/versionbits.cpp')
-rw-r--r--src/versionbits.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/versionbits.cpp b/src/versionbits.cpp
index df2ec4e056..07ecc93c93 100644
--- a/src/versionbits.cpp
+++ b/src/versionbits.cpp
@@ -192,6 +192,7 @@ public:
ThresholdState VersionBitsState(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache)
{
+ LOCK(cache.mutex);
return VersionBitsConditionChecker(pos).GetStateFor(pindexPrev, params, cache.caches[pos]);
}
@@ -202,6 +203,7 @@ BIP9Stats VersionBitsStatistics(const CBlockIndex* pindexPrev, const Consensus::
int VersionBitsStateSinceHeight(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache)
{
+ LOCK(cache.mutex);
return VersionBitsConditionChecker(pos).GetStateSinceHeightFor(pindexPrev, params, cache.caches[pos]);
}
@@ -212,6 +214,7 @@ uint32_t VersionBitsMask(const Consensus::Params& params, Consensus::DeploymentP
void VersionBitsCache::Clear()
{
+ LOCK(mutex);
for (unsigned int d = 0; d < Consensus::MAX_VERSION_BITS_DEPLOYMENTS; d++) {
caches[d].clear();
}