fix!: llmqTypeInstantSend deactivation prevention if used for other purposes (#4848)

This commit is contained in:
Odysseas Gabrielides 2022-05-26 23:16:13 +03:00 committed by GitHub
parent d8cc65bd4d
commit acb1dd6179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -536,6 +536,17 @@ bool CLLMQUtils::IsDIP0024Active(const CBlockIndex* pindex)
return VersionBitsState(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024, llmq_versionbitscache) == ThresholdState::ACTIVE;
}
bool CLLMQUtils::IsInstantSendLLMQTypeShared()
{
if (Params().GetConsensus().llmqTypeInstantSend == Params().GetConsensus().llmqTypeChainLocks ||
Params().GetConsensus().llmqTypeInstantSend == Params().GetConsensus().llmqTypePlatform ||
Params().GetConsensus().llmqTypeInstantSend == Params().GetConsensus().llmqTypeMnhf) {
return true;
}
return false;
}
uint256 CLLMQUtils::DeterministicOutboundConnection(const uint256& proTxHash1, const uint256& proTxHash2)
{
// We need to deterministically select who is going to initiate the connection. The naive way would be to simply
@ -755,6 +766,9 @@ bool CLLMQUtils::IsQuorumTypeEnabledInternal(Consensus::LLMQType llmqType, const
{
case Consensus::LLMQType::LLMQ_TEST_INSTANTSEND:
case Consensus::LLMQType::LLMQ_50_60: {
if (IsInstantSendLLMQTypeShared()) {
break;
}
bool fDIP0024IsActive = optDIP0024IsActive.has_value() ? *optDIP0024IsActive : CLLMQUtils::IsDIP0024Active(pindex);
if (fDIP0024IsActive) {
bool fHaveDIP0024Quorums = optHaveDIP0024Quorums.has_value() ? *optHaveDIP0024Quorums

View File

@ -92,6 +92,7 @@ public:
static Consensus::LLMQType GetInstantSendLLMQType(const CBlockIndex* pindex);
static Consensus::LLMQType GetInstantSendLLMQType(bool deterministic);
static bool IsDIP0024Active(const CBlockIndex* pindex);
static bool IsInstantSendLLMQTypeShared();
/// Returns the state of `-llmq-data-recovery`
static bool QuorumDataRecoveryEnabled();