|
12 | 12 | #include <chainparams.h> |
13 | 13 | #include <consensus/params.h> |
14 | 14 | #include <consensus/validation.h> |
| 15 | +#include <deploymentstatus.h> |
15 | 16 | #include <logging.h> |
16 | 17 | #include <tinyformat.h> |
17 | 18 | #include <util/ranges_set.h> |
@@ -113,13 +114,18 @@ bool CAssetUnlockPayload::VerifySig(const llmq::CQuorumManager& qman, const uint |
113 | 114 | // and at the quorumHash must be active in either the current or previous quorum cycle |
114 | 115 | // and the sig must validate against that specific quorumHash. |
115 | 116 |
|
| 117 | + |
116 | 118 | Consensus::LLMQType llmqType = Params().GetConsensus().llmqTypePlatform; |
117 | 119 |
|
118 | | - // We check at most 2 quorums |
119 | | - const auto quorums = qman.ScanQuorums(llmqType, pindexTip, 2); |
| 120 | + const auto& llmq_params_opt = Params().GetLLMQ(llmqType); |
| 121 | + assert(llmq_params_opt.has_value()); |
| 122 | + |
| 123 | + // after deployment WITHDRAWALS activated we check not to quorum, but all active quorums + 1 the latest inactive |
| 124 | + const int quorums_to_scan = DeploymentActiveAt(*pindexTip, Params().GetConsensus(), Consensus::DEPLOYMENT_WITHDRAWALS) ? (llmq_params_opt->signingActiveQuorumCount + 1) : 2; |
| 125 | + const auto quorums = qman.ScanQuorums(llmqType, pindexTip, quorums_to_scan); |
120 | 126 |
|
121 | 127 | if (bool isActive = std::any_of(quorums.begin(), quorums.end(), [&](const auto &q) { return q->qc->quorumHash == quorumHash; }); !isActive) { |
122 | | - return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-assetunlock-not-active-quorum"); |
| 128 | + return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-assetunlock-too-old-quorum"); |
123 | 129 | } |
124 | 130 |
|
125 | 131 | if (static_cast<uint32_t>(pindexTip->nHeight) < requestedHeight || pindexTip->nHeight >= getHeightToExpiry()) { |
|
0 commit comments