mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
fix: using proper quorums for asset unlock validation
This commit is contained in:
parent
0253438503
commit
27040030e9
@ -12,6 +12,7 @@
|
||||
#include <chainparams.h>
|
||||
#include <consensus/params.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <deploymentstatus.h>
|
||||
#include <logging.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/ranges_set.h>
|
||||
@ -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<uint32_t>(pindexTip->nHeight) < requestedHeight || pindexTip->nHeight >= getHeightToExpiry()) {
|
||||
|
Loading…
Reference in New Issue
Block a user