mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
feat: replace assert to error in p2p code of Asset Lock
It is impossible situation which will never happen. But better to change it to exception for better error-prune implementation in case someone will decide to change this code: 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-too-old-quorum"); } ... const auto quorum = qman.GetQuorum(llmqType, quorumHash); assert(quorum); <-- for sure exist because we just scanned quorums
This commit is contained in:
parent
c97f5f5ca5
commit
e43ca6243a
@ -138,7 +138,10 @@ bool CAssetUnlockPayload::VerifySig(const llmq::CQuorumManager& qman, const uint
|
||||
}
|
||||
|
||||
const auto quorum = qman.GetQuorum(llmqType, quorumHash);
|
||||
assert(quorum);
|
||||
// quorum must be valid at this point. Let's check and throw error just in case
|
||||
if (!quorum) {
|
||||
return state.Invalid(TxValidationResult::TX_CONSENSUS, "internal-error");
|
||||
}
|
||||
|
||||
const uint256 requestId = ::SerializeHash(std::make_pair(ASSETUNLOCK_REQUESTID_PREFIX, index));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user