diff --git a/src/evo/assetlocktx.cpp b/src/evo/assetlocktx.cpp index ccbb0042e0..64ee2b32c4 100644 --- a/src/evo/assetlocktx.cpp +++ b/src/evo/assetlocktx.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -113,13 +114,18 @@ bool CAssetUnlockPayload::VerifySig(const llmq::CQuorumManager& qman, const uint // and at the quorumHash must be active in either the current or previous quorum cycle // and the sig must validate against that specific quorumHash. + Consensus::LLMQType llmqType = Params().GetConsensus().llmqTypePlatform; - // We check at most 2 quorums - const auto quorums = qman.ScanQuorums(llmqType, pindexTip, 2); + const auto& llmq_params_opt = Params().GetLLMQ(llmqType); + assert(llmq_params_opt.has_value()); + + // after deployment WITHDRAWALS activated we check not to quorum, but all active quorums + 1 the latest inactive + const int quorums_to_scan = DeploymentActiveAt(*pindexTip, Params().GetConsensus(), Consensus::DEPLOYMENT_WITHDRAWALS) ? (llmq_params_opt->signingActiveQuorumCount + 1) : 2; + const auto quorums = qman.ScanQuorums(llmqType, pindexTip, quorums_to_scan); if (bool isActive = std::any_of(quorums.begin(), quorums.end(), [&](const auto &q) { return q->qc->quorumHash == quorumHash; }); !isActive) { - return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-assetunlock-not-active-quorum"); + return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-assetunlock-too-old-quorum"); } if (static_cast(pindexTip->nHeight) < requestedHeight || pindexTip->nHeight >= getHeightToExpiry()) {