diff --git a/src/llmq/context.cpp b/src/llmq/context.cpp index 2162f36ed3..3583675561 100644 --- a/src/llmq/context.cpp +++ b/src/llmq/context.cpp @@ -60,10 +60,7 @@ LLMQContext::~LLMQContext() { llmq::chainLocksHandler.reset(); llmq::quorumManager.reset(); llmq::quorumBlockProcessor.reset(); - { - LOCK(llmq::cs_llmq_vbc); - llmq::llmq_versionbitscache.Clear(); - } + llmq::llmq_versionbitscache.Clear(); } void LLMQContext::Interrupt() { diff --git a/src/llmq/utils.cpp b/src/llmq/utils.cpp index 98daba584a..8105ac5520 100644 --- a/src/llmq/utils.cpp +++ b/src/llmq/utils.cpp @@ -35,7 +35,6 @@ std::optional> GetNonNullCoinbaseChainlock(co namespace llmq { -Mutex cs_llmq_vbc; VersionBitsCache llmq_versionbitscache; namespace utils @@ -708,7 +707,6 @@ bool IsV19Active(gsl::not_null pindex) bool IsV20Active(gsl::not_null pindex) { - LOCK(cs_llmq_vbc); return llmq_versionbitscache.State(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20) == ThresholdState::ACTIVE; } @@ -716,19 +714,16 @@ bool IsMNRewardReallocationActive(gsl::not_null pindex) { if (!IsV20Active(pindex)) return false; - LOCK(cs_llmq_vbc); return llmq_versionbitscache.State(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_MN_RR) == ThresholdState::ACTIVE; } ThresholdState GetV20State(gsl::not_null pindex) { - LOCK(cs_llmq_vbc); return llmq_versionbitscache.State(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20); } int GetV20Since(gsl::not_null pindex) { - LOCK(cs_llmq_vbc); return llmq_versionbitscache.StateSinceHeight(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_V20); } @@ -1005,7 +1000,6 @@ bool IsQuorumTypeEnabledInternal(Consensus::LLMQType llmqType, const CQuorumMana return true; case Consensus::LLMQType::LLMQ_TEST_V17: { - LOCK(cs_llmq_vbc); return llmq_versionbitscache.State(pindex, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY) == ThresholdState::ACTIVE; } case Consensus::LLMQType::LLMQ_100_67: diff --git a/src/llmq/utils.h b/src/llmq/utils.h index 02037feadc..2db8da2725 100644 --- a/src/llmq/utils.h +++ b/src/llmq/utils.h @@ -30,10 +30,10 @@ namespace llmq class CQuorumManager; class CQuorumSnapshot; -// Use a separate cache instance instead of versionbitscache to avoid locking cs_main +// A separate cache instance instead of versionbitscache has been introduced to avoid locking cs_main // and dealing with all kinds of deadlocks. -extern Mutex cs_llmq_vbc; -extern VersionBitsCache llmq_versionbitscache GUARDED_BY(cs_llmq_vbc); +// TODO: drop llmq_versionbitscache completely so far as VersionBitsCache do not uses anymore cs_main +extern VersionBitsCache llmq_versionbitscache; static const bool DEFAULT_ENABLE_QUORUM_DATA_RECOVERY = true;