refactor: drop llmq_versionbitscache in favor of g_versionbitscache

Note: g_versionbitscache is reset in UnloadBlockIndex()
This commit is contained in:
Konstantin Akimov 2023-12-05 03:23:35 +07:00 committed by PastaPastaPasta
parent 917089d542
commit f57859f777
3 changed files with 3 additions and 11 deletions

View File

@ -60,7 +60,6 @@ LLMQContext::~LLMQContext() {
llmq::chainLocksHandler.reset();
llmq::quorumManager.reset();
llmq::quorumBlockProcessor.reset();
llmq::llmq_versionbitscache.Clear();
}
void LLMQContext::Interrupt() {

View File

@ -40,14 +40,12 @@ static bool IsV19Active(gsl::not_null<const CBlockIndex*> pindexPrev)
static bool IsV20Active(gsl::not_null<const CBlockIndex*> 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:

View File

@ -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 {