From f57859f777b7a59788af3ced51e5a99e179e2c39 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Tue, 5 Dec 2023 03:23:35 +0700 Subject: [PATCH] refactor: drop llmq_versionbitscache in favor of g_versionbitscache Note: g_versionbitscache is reset in UnloadBlockIndex() --- src/llmq/context.cpp | 1 - src/llmq/utils.cpp | 8 +++----- src/llmq/utils.h | 5 ----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/llmq/context.cpp b/src/llmq/context.cpp index 3583675561..a7f77c2fb0 100644 --- a/src/llmq/context.cpp +++ b/src/llmq/context.cpp @@ -60,7 +60,6 @@ LLMQContext::~LLMQContext() { llmq::chainLocksHandler.reset(); llmq::quorumManager.reset(); llmq::quorumBlockProcessor.reset(); - llmq::llmq_versionbitscache.Clear(); } void LLMQContext::Interrupt() { diff --git a/src/llmq/utils.cpp b/src/llmq/utils.cpp index f4549563c1..b6dfb92de7 100644 --- a/src/llmq/utils.cpp +++ b/src/llmq/utils.cpp @@ -40,14 +40,12 @@ static bool IsV19Active(gsl::not_null pindexPrev) static bool IsV20Active(gsl::not_null pindexPrev) { - return llmq_versionbitscache.State(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_V20) == ThresholdState::ACTIVE; + return DeploymentActiveAfter(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_V20); } namespace llmq { -VersionBitsCache llmq_versionbitscache; - namespace utils { @@ -953,10 +951,10 @@ bool IsQuorumTypeEnabledInternal(Consensus::LLMQType llmqType, const CQuorumMana return true; case Consensus::LLMQType::LLMQ_TEST_V17: { - return llmq_versionbitscache.State(pindexPrev, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY) == ThresholdState::ACTIVE; + return DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_TESTDUMMY); } case Consensus::LLMQType::LLMQ_100_67: - return pindexPrev->nHeight + 1 >= consensusParams.DIP0020Height; + return DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_DIP0020); case Consensus::LLMQType::LLMQ_60_75: case Consensus::LLMQType::LLMQ_DEVNET_DIP0024: diff --git a/src/llmq/utils.h b/src/llmq/utils.h index 8a09a58ae0..9f2e8bd229 100644 --- a/src/llmq/utils.h +++ b/src/llmq/utils.h @@ -29,11 +29,6 @@ namespace llmq class CQuorumManager; class CQuorumSnapshot; -// A separate cache instance instead of versionbitscache has been introduced to avoid locking cs_main -// and dealing with all kinds of deadlocks. -// 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; enum class QvvecSyncMode {