mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
fix: scan quorums instead just using verified sigs
This commit is contained in:
parent
4b046bb608
commit
f7705cdf72
@ -53,24 +53,21 @@ CMNHFManager::Signals CMNHFManager::GetSignalsStage(const CBlockIndex* const pin
|
||||
return signals;
|
||||
}
|
||||
|
||||
bool MNHFTx::Verify(const CBlockIndex* const pQuorumIndex, const uint256& msgHash, TxValidationState& state) const
|
||||
bool MNHFTx::Verify(const uint256& quorumHash, const uint256& msgHash, TxValidationState& state) const
|
||||
{
|
||||
if (versionBit >= VERSIONBITS_NUM_BITS) {
|
||||
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-nbit-out-of-bounds");
|
||||
}
|
||||
|
||||
Consensus::LLMQType llmqType = Params().GetConsensus().llmqTypeMnhf;
|
||||
const auto& llmq_params_opt = llmq::GetLLMQParams(llmqType);
|
||||
if (!llmq_params_opt.has_value()) {
|
||||
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-quorum-type");
|
||||
}
|
||||
int signOffset{llmq_params_opt->dkgInterval};
|
||||
const Consensus::LLMQType& llmqType = Params().GetConsensus().llmqTypeMnhf;
|
||||
const auto quorum = llmq::quorumManager->GetQuorum(llmqType, quorumHash);
|
||||
|
||||
const uint256 requestId = ::SerializeHash(std::make_pair(MNEHF_REQUESTID_PREFIX, int64_t{versionBit}));
|
||||
|
||||
if (!llmq::CSigningManager::VerifyRecoveredSig(llmqType, *llmq::quorumManager, pQuorumIndex->nHeight + signOffset, requestId, msgHash, sig)) {
|
||||
const uint256 signHash = llmq::utils::BuildSignHash(llmqType, quorum->qc->quorumHash, requestId, msgHash);
|
||||
if (!sig.VerifyInsecure(quorum->qc->quorumPublicKey, signHash)) {
|
||||
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-invalid");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -107,7 +104,7 @@ bool CheckMNHFTx(const CTransaction& tx, const CBlockIndex* pindexPrev, TxValida
|
||||
uint256 msgHash = tx_copy.GetHash();
|
||||
|
||||
|
||||
if (!mnhfTx.signal.Verify(pindexQuorum, msgHash, state)) {
|
||||
if (!mnhfTx.signal.Verify(mnhfTx.signal.quorumHash, msgHash, state)) {
|
||||
// set up inside Verify
|
||||
return false;
|
||||
}
|
||||
|
@ -28,11 +28,11 @@ class MNHFTx
|
||||
{
|
||||
public:
|
||||
uint8_t versionBit{0};
|
||||
uint256 quorumHash;
|
||||
CBLSSignature sig;
|
||||
uint256 quorumHash{0};
|
||||
CBLSSignature sig{};
|
||||
|
||||
MNHFTx() = default;
|
||||
bool Verify(const CBlockIndex* const pQuorumIndex, const uint256& msgHash, TxValidationState& state) const;
|
||||
bool Verify(const uint256& quorumHash, const uint256& msgHash, TxValidationState& state) const;
|
||||
|
||||
SERIALIZE_METHODS(MNHFTx, obj)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user