From ba19b0cee91dbc592a8a0a281edf1c6b2967717f Mon Sep 17 00:00:00 2001 From: xdustinface Date: Tue, 9 Mar 2021 21:26:04 +0100 Subject: [PATCH] llmq: Adjust GetQuorumRecoveryStartOffset to use all MNs --- src/llmq/quorums.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index 07744efd444e1..a0caf98b393e0 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -514,23 +514,16 @@ CQuorumCPtr CQuorumManager::GetQuorum(Consensus::LLMQType llmqType, const CBlock size_t CQuorumManager::GetQuorumRecoveryStartOffset(const CQuorumCPtr pQuorum, const CBlockIndex* pIndex) const { - const size_t nActiveQuorums = pQuorum->params.signingActiveQuorumCount + 1; - const std::vector vecQuorums = ScanQuorums(pQuorum->params.type, pIndex, nActiveQuorums); - assert(vecQuorums.size() > 0); - std::set setAllTypeMembers; - for (auto& q : vecQuorums) { - auto& vecValid = q->qc.validMembers; - for (size_t i = 0; i < vecValid.size(); ++i) { - if (vecValid[i]) { - setAllTypeMembers.emplace(q->members[i]->proTxHash); - } - } - } - std::vector vecAllTypeMembers{setAllTypeMembers.begin(), setAllTypeMembers.end()}; - std::sort(vecAllTypeMembers.begin(), vecAllTypeMembers.end()); + auto mns = deterministicMNManager->GetListForBlock(pIndex); + std::vector vecProTxHashes; + vecProTxHashes.reserve(mns.GetValidMNsCount()); + mns.ForEachMN(true, [&](const CDeterministicMNCPtr& pMasternode) { + vecProTxHashes.emplace_back(pMasternode->proTxHash); + }); + std::sort(vecProTxHashes.begin(), vecProTxHashes.end()); size_t nIndex{0}; - for (size_t i = 0; i < vecAllTypeMembers.size(); ++i) { - if (activeMasternodeInfo.proTxHash == vecAllTypeMembers[i]) { + for (size_t i = 0; i < vecProTxHashes.size(); ++i) { + if (activeMasternodeInfo.proTxHash == vecProTxHashes[i]) { nIndex = i; break; }