From 12972fe88e0c2185a01ca4826a271900ee2ecf2b Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 15 Jul 2021 15:28:58 -0500 Subject: [PATCH] refactor: utilize GetLLMQParams, make it const, consistent naming Removes all (besides one) usages of "Params().GetConsensus().llmqs.at" and instead uses the wrapper in quorum_utils.cpp Rename all params to llmq_params for consistency and not conflict with non-llmq params make some llmq_params const where possible remove unneeded llmq_params variables where it's only used once Signed-off-by: pasta --- src/evo/cbtx.cpp | 8 ++++---- src/evo/deterministicmns.cpp | 4 ++-- src/init.cpp | 4 ++-- src/llmq/quorums.cpp | 6 +++--- src/llmq/quorums_blockprocessor.cpp | 25 +++++++++++------------- src/llmq/quorums_commitment.cpp | 15 +++++++-------- src/llmq/quorums_debug.cpp | 6 ++---- src/llmq/quorums_instantsend.cpp | 2 +- src/llmq/quorums_signing.cpp | 3 +-- src/llmq/quorums_signing_shares.cpp | 21 +++++++------------- src/llmq/quorums_utils.cpp | 7 ++----- src/rpc/rpcquorums.cpp | 30 ++++++++++++++--------------- 12 files changed, 57 insertions(+), 74 deletions(-) diff --git a/src/evo/cbtx.cpp b/src/evo/cbtx.cpp index 788cc50d06..912d8e79c2 100644 --- a/src/evo/cbtx.cpp +++ b/src/evo/cbtx.cpp @@ -212,9 +212,9 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre continue; } auto qcHash = ::SerializeHash(qc.commitment); - const auto& params = Params().GetConsensus().llmqs.at((Consensus::LLMQType)qc.commitment.llmqType); - auto& v = qcHashes[params.type]; - if (v.size() == params.signingActiveQuorumCount) { + const auto& llmq_params = llmq::GetLLMQParams(qc.commitment.llmqType); + auto& v = qcHashes[llmq_params.type]; + if (v.size() == llmq_params.signingActiveQuorumCount) { // we pop the last entry, which is actually the oldest quorum as GetMinedAndActiveCommitmentsUntilBlock // returned quorums in reversed order. This pop and later push can only work ONCE, but we rely on the // fact that a block can only contain a single commitment for one LLMQ type @@ -222,7 +222,7 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre } v.emplace_back(qcHash); hashCount++; - if (v.size() > params.signingActiveQuorumCount) { + if (v.size() > llmq_params.signingActiveQuorumCount) { return state.DoS(100, false, REJECT_INVALID, "excess-quorums-calc-cbtx-quorummerkleroot"); } } diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index 88b664f97a..7792a14ff8 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -874,8 +874,8 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C return _state.DoS(100, false, REJECT_INVALID, "bad-qc-payload"); } if (!qc.commitment.IsNull()) { - const auto& params = Params().GetConsensus().llmqs.at(qc.commitment.llmqType); - uint32_t quorumHeight = qc.nHeight - (qc.nHeight % params.dkgInterval); + const auto& llmq_params = llmq::GetLLMQParams(qc.commitment.llmqType); + uint32_t quorumHeight = qc.nHeight - (qc.nHeight % llmq_params.dkgInterval); auto quorumIndex = pindexPrev->GetAncestor(quorumHeight); if (!quorumIndex || quorumIndex->GetBlockHash() != qc.commitment.quorumHash) { // we should actually never get into this case as validation should have catched it...but lets be sure diff --git a/src/init.cpp b/src/init.cpp index b5e35c4e25..e12704c0b0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1583,8 +1583,8 @@ bool AppInitParameterInteraction() } if (chainparams.NetworkIDString() == CBaseChainParams::DEVNET) { - std::string strLLMQTypeChainLocks = gArgs.GetArg("-llmqchainlocks", Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqTypeChainLocks).name); - std::string strLLMQTypeInstantSend = gArgs.GetArg("-llmqinstantsend", Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqTypeInstantSend).name); + std::string strLLMQTypeChainLocks = gArgs.GetArg("-llmqchainlocks", llmq::GetLLMQParams(Params().GetConsensus().llmqTypeChainLocks).name); + std::string strLLMQTypeInstantSend = gArgs.GetArg("-llmqinstantsend", llmq::GetLLMQParams(Params().GetConsensus().llmqTypeInstantSend).name); Consensus::LLMQType llmqTypeChainLocks = Consensus::LLMQ_NONE; Consensus::LLMQType llmqTypeInstantSend = Consensus::LLMQ_NONE; for (const auto& p : Params().GetConsensus().llmqs) { diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index 0694dbcc96..dd3a3fac72 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -264,15 +264,15 @@ void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitial void CQuorumManager::EnsureQuorumConnections(Consensus::LLMQType llmqType, const CBlockIndex* pindexNew) const { - const auto& params = Params().GetConsensus().llmqs.at(llmqType); + const auto& llmq_params = GetLLMQParams(llmqType); const auto& myProTxHash = activeMasternodeInfo.proTxHash; - auto lastQuorums = ScanQuorums(llmqType, pindexNew, (size_t)params.keepOldConnections); + auto lastQuorums = ScanQuorums(llmqType, pindexNew, (size_t)llmq_params.keepOldConnections); auto connmanQuorumsToDelete = g_connman->GetMasternodeQuorums(llmqType); // don't remove connections for the currently in-progress DKG round - int curDkgHeight = pindexNew->nHeight - (pindexNew->nHeight % params.dkgInterval); + int curDkgHeight = pindexNew->nHeight - (pindexNew->nHeight % llmq_params.dkgInterval); auto curDkgBlock = pindexNew->GetAncestor(curDkgHeight)->GetBlockHash(); connmanQuorumsToDelete.erase(curDkgBlock); diff --git a/src/llmq/quorums_blockprocessor.cpp b/src/llmq/quorums_blockprocessor.cpp index b930879625..cb72e31c73 100644 --- a/src/llmq/quorums_blockprocessor.cpp +++ b/src/llmq/quorums_blockprocessor.cpp @@ -66,7 +66,6 @@ void CQuorumBlockProcessor::ProcessMessage(CNode* pfrom, const std::string& strC return; } auto type = qc.llmqType; - const auto& params = Params().GetConsensus().llmqs.at(type); // Verify that quorumHash is part of the active chain and that it's the first block in the DKG interval const CBlockIndex* pquorumIndex; @@ -86,7 +85,7 @@ void CQuorumBlockProcessor::ProcessMessage(CNode* pfrom, const std::string& strC // same, can't punish return; } - int quorumHeight = pquorumIndex->nHeight - (pquorumIndex->nHeight % params.dkgInterval); + int quorumHeight = pquorumIndex->nHeight - (pquorumIndex->nHeight % GetLLMQParams(type).dkgInterval); if (quorumHeight != pquorumIndex->nHeight) { LogPrint(BCLog::LLMQ, "CQuorumBlockProcessor::%s -- block %s is not the first block in the DKG interval, peer=%d\n", __func__, qc.quorumHash.ToString(), pfrom->GetId()); @@ -189,7 +188,7 @@ static std::tuple BuildInversedHeigh bool CQuorumBlockProcessor::ProcessCommitment(int nHeight, const uint256& blockHash, const CFinalCommitment& qc, CValidationState& state, bool fJustCheck) { - auto& params = Params().GetConsensus().llmqs.at(qc.llmqType); + const auto& llmq_params = GetLLMQParams(qc.llmqType); uint256 quorumHash = GetQuorumBlockHash(qc.llmqType, nHeight); @@ -212,12 +211,12 @@ bool CQuorumBlockProcessor::ProcessCommitment(int nHeight, const uint256& blockH return true; } - if (HasMinedCommitment(params.type, quorumHash)) { + if (HasMinedCommitment(llmq_params.type, quorumHash)) { // should not happen as it's already handled in ProcessBlock return state.DoS(100, false, REJECT_INVALID, "bad-qc-dup"); } - if (!IsMiningPhase(params.type, nHeight)) { + if (!IsMiningPhase(llmq_params.type, nHeight)) { // should not happen as it's already handled in ProcessBlock return state.DoS(100, false, REJECT_INVALID, "bad-qc-height"); } @@ -233,9 +232,9 @@ bool CQuorumBlockProcessor::ProcessCommitment(int nHeight, const uint256& blockH } // Store commitment in DB - auto cacheKey = std::make_pair(params.type, quorumHash); + auto cacheKey = std::make_pair(llmq_params.type, quorumHash); evoDb.Write(std::make_pair(DB_MINED_COMMITMENT, cacheKey), std::make_pair(qc, blockHash)); - evoDb.Write(BuildInversedHeightKey(params.type, nHeight), quorumIndex->nHeight); + evoDb.Write(BuildInversedHeightKey(llmq_params.type, nHeight), quorumIndex->nHeight); { LOCK(minableCommitmentsCs); @@ -369,9 +368,9 @@ bool CQuorumBlockProcessor::GetCommitmentsFromBlock(const CBlock& block, const C bool CQuorumBlockProcessor::IsMiningPhase(Consensus::LLMQType llmqType, int nHeight) { - const auto& params = Params().GetConsensus().llmqs.at(llmqType); - int phaseIndex = nHeight % params.dkgInterval; - if (phaseIndex >= params.dkgMiningWindowStart && phaseIndex <= params.dkgMiningWindowEnd) { + const auto& llmq_params = GetLLMQParams(llmqType); + int phaseIndex = nHeight % llmq_params.dkgInterval; + if (phaseIndex >= llmq_params.dkgMiningWindowStart && phaseIndex <= llmq_params.dkgMiningWindowEnd) { return true; } return false; @@ -396,9 +395,7 @@ uint256 CQuorumBlockProcessor::GetQuorumBlockHash(Consensus::LLMQType llmqType, { AssertLockHeld(cs_main); - auto& params = Params().GetConsensus().llmqs.at(llmqType); - - int quorumStartHeight = nHeight - (nHeight % params.dkgInterval); + int quorumStartHeight = nHeight - (nHeight % GetLLMQParams(llmqType).dkgInterval); uint256 quorumBlockHash; if (!GetBlockHash(quorumBlockHash, quorumStartHeight)) { return {}; @@ -567,7 +564,7 @@ bool CQuorumBlockProcessor::GetMineableCommitment(Consensus::LLMQType llmqType, auto it = minableCommitmentsByQuorum.find(k); if (it == minableCommitmentsByQuorum.end()) { // null commitment required - ret = CFinalCommitment(Params().GetConsensus().llmqs.at(llmqType), quorumHash); + ret = CFinalCommitment(GetLLMQParams(llmqType), quorumHash); return true; } diff --git a/src/llmq/quorums_commitment.cpp b/src/llmq/quorums_commitment.cpp index b1f68a3fad..438b3956d5 100644 --- a/src/llmq/quorums_commitment.cpp +++ b/src/llmq/quorums_commitment.cpp @@ -36,17 +36,17 @@ bool CFinalCommitment::Verify(const CBlockIndex* pQuorumIndex, bool checkSigs) c LogPrintfFinalCommitment("invalid llmqType=%d\n", llmqType); return false; } - const auto& params = Params().GetConsensus().llmqs.at(llmqType); + const auto& llmq_params = GetLLMQParams(llmqType); - if (!VerifySizes(params)) { + if (!VerifySizes(llmq_params)) { return false; } - if (CountValidMembers() < params.minSize) { + if (CountValidMembers() < llmq_params.minSize) { LogPrintfFinalCommitment("invalid validMembers count. validMembersCount=%d\n", CountValidMembers()); return false; } - if (CountSigners() < params.minSize) { + if (CountSigners() < llmq_params.minSize) { LogPrintfFinalCommitment("invalid signers count. signersCount=%d\n", CountSigners()); return false; } @@ -68,7 +68,7 @@ bool CFinalCommitment::Verify(const CBlockIndex* pQuorumIndex, bool checkSigs) c } auto members = CLLMQUtils::GetAllQuorumMembers(llmqType, pQuorumIndex); - for (size_t i = members.size(); i < params.size; i++) { + for (size_t i = members.size(); i < llmq_params.size; i++) { if (validMembers[i]) { LogPrintfFinalCommitment("invalid validMembers bitset. bit %d should not be set\n", i); return false; @@ -81,7 +81,7 @@ bool CFinalCommitment::Verify(const CBlockIndex* pQuorumIndex, bool checkSigs) c // sigs are only checked when the block is processed if (checkSigs) { - uint256 commitmentHash = CLLMQUtils::BuildCommitmentHash(params.type, quorumHash, validMembers, quorumPublicKey, quorumVvecHash); + uint256 commitmentHash = CLLMQUtils::BuildCommitmentHash(llmq_params.type, quorumHash, validMembers, quorumPublicKey, quorumVvecHash); std::vector memberPubKeys; for (size_t i = 0; i < members.size(); i++) { @@ -111,9 +111,8 @@ bool CFinalCommitment::VerifyNull() const LogPrintfFinalCommitment("invalid llmqType=%d\n", llmqType); return false; } - const auto& params = Params().GetConsensus().llmqs.at(llmqType); - if (!IsNull() || !VerifySizes(params)) { + if (!IsNull() || !VerifySizes(GetLLMQParams(llmqType))) { return false; } diff --git a/src/llmq/quorums_debug.cpp b/src/llmq/quorums_debug.cpp index a3e723699d..cba2916a7f 100644 --- a/src/llmq/quorums_debug.cpp +++ b/src/llmq/quorums_debug.cpp @@ -124,8 +124,7 @@ UniValue CDKGDebugStatus::ToJson(int detailLevel) const if (!Params().GetConsensus().llmqs.count(p.first)) { continue; } - const auto& params = Params().GetConsensus().llmqs.at(p.first); - sessionsJson.pushKV(params.name, p.second.ToJson(detailLevel)); + sessionsJson.pushKV(GetLLMQParams(p.first).name, p.second.ToJson(detailLevel)); } ret.pushKV("session", sessionsJson); @@ -161,7 +160,6 @@ void CDKGDebugManager::InitLocalSessionStatus(Consensus::LLMQType llmqType, cons it = localStatus.sessions.emplace(llmqType, CDKGDebugSessionStatus()).first; } - auto& params = Params().GetConsensus().llmqs.at(llmqType); auto& session = it->second; session.llmqType = llmqType; session.quorumHash = quorumHash; @@ -169,7 +167,7 @@ void CDKGDebugManager::InitLocalSessionStatus(Consensus::LLMQType llmqType, cons session.phase = 0; session.statusBitset = 0; session.members.clear(); - session.members.resize((size_t)params.size); + session.members.resize((size_t)GetLLMQParams(llmqType).size); } void CDKGDebugManager::UpdateLocalSessionStatus(Consensus::LLMQType llmqType, std::function&& func) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 7e5d8117d8..7573398c0b 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -821,7 +821,7 @@ bool CInstantSendManager::ProcessPendingInstantSendLocks() } auto llmqType = Params().GetConsensus().llmqTypeInstantSend; - auto dkgInterval = Params().GetConsensus().llmqs.at(llmqType).dkgInterval; + auto dkgInterval = GetLLMQParams(llmqType).dkgInterval; // First check against the current active set and don't ban auto badISLocks = ProcessPendingInstantSendLocks(0, pend, false); diff --git a/src/llmq/quorums_signing.cpp b/src/llmq/quorums_signing.cpp index 143d15acfd..70c82783fc 100644 --- a/src/llmq/quorums_signing.cpp +++ b/src/llmq/quorums_signing.cpp @@ -899,8 +899,7 @@ bool CSigningManager::GetVoteForId(Consensus::LLMQType llmqType, const uint256& CQuorumCPtr CSigningManager::SelectQuorumForSigning(Consensus::LLMQType llmqType, const uint256& selectionHash, int signHeight, int signOffset) { - auto& llmqParams = Params().GetConsensus().llmqs.at(llmqType); - size_t poolSize = (size_t)llmqParams.signingActiveQuorumCount; + size_t poolSize = GetLLMQParams(llmqType).signingActiveQuorumCount; CBlockIndex* pindexStart; { diff --git a/src/llmq/quorums_signing_shares.cpp b/src/llmq/quorums_signing_shares.cpp index d9c45a3114..5b2e0f3ea9 100644 --- a/src/llmq/quorums_signing_shares.cpp +++ b/src/llmq/quorums_signing_shares.cpp @@ -107,16 +107,16 @@ std::string CBatchedSigShares::ToInvString() const template static void InitSession(CSigSharesNodeState::Session& s, const uint256& signHash, T& from) { - const auto& params = Params().GetConsensus().llmqs.at((Consensus::LLMQType)from.llmqType); + const auto& llmq_params = GetLLMQParams((Consensus::LLMQType)from.llmqType); s.llmqType = (Consensus::LLMQType)from.llmqType; s.quorumHash = from.quorumHash; s.id = from.id; s.msgHash = from.msgHash; s.signHash = signHash; - s.announced.Init((size_t)params.size); - s.requested.Init((size_t)params.size); - s.knows.Init((size_t)params.size); + s.announced.Init((size_t)llmq_params.size); + s.requested.Init((size_t)llmq_params.size); + s.knows.Init((size_t)llmq_params.size); } CSigSharesNodeState::Session& CSigSharesNodeState::GetOrCreateSessionFromShare(const llmq::CSigShare& sigShare) @@ -350,12 +350,7 @@ bool CSigSharesManager::ProcessMessageSigSesAnn(CNode* pfrom, const CSigSesAnn& bool CSigSharesManager::VerifySigSharesInv(Consensus::LLMQType llmqType, const CSigSharesInv& inv) { - size_t quorumSize = (size_t)Params().GetConsensus().llmqs.at(llmqType).size; - - if (inv.inv.size() != quorumSize) { - return false; - } - return true; + return inv.inv.size() == GetLLMQParams(llmqType).size; } bool CSigSharesManager::ProcessMessageSigSharesInv(CNode* pfrom, const CSigSharesInv& inv) @@ -949,8 +944,7 @@ void CSigSharesManager::CollectSigSharesToRequest(std::unordered_mapllmqType); - inv.Init((size_t)params.size); + inv.Init(GetLLMQParams(sigShare->llmqType).size); } inv.inv[quorumMember] = true; session.knows.inv[quorumMember] = true; diff --git a/src/llmq/quorums_utils.cpp b/src/llmq/quorums_utils.cpp index b6c76e60b5..1d20150526 100644 --- a/src/llmq/quorums_utils.cpp +++ b/src/llmq/quorums_utils.cpp @@ -42,10 +42,9 @@ std::vector CLLMQUtils::GetAllQuorumMembers(Consensus::LLM } } - auto& params = Params().GetConsensus().llmqs.at(llmqType); auto allMns = deterministicMNManager->GetListForBlock(pindexQuorum); auto modifier = ::SerializeHash(std::make_pair(llmqType, pindexQuorum->GetBlockHash())); - quorumMembers = allMns.CalculateQuorum(params.size, modifier); + quorumMembers = allMns.CalculateQuorum(GetLLMQParams(llmqType).size, modifier); LOCK(cs_members); mapQuorumMembers[llmqType].insert(pindexQuorum->GetBlockHash(), quorumMembers); return quorumMembers; @@ -288,12 +287,10 @@ void CLLMQUtils::AddQuorumProbeConnections(Consensus::LLMQType llmqType, const C bool CLLMQUtils::IsQuorumActive(Consensus::LLMQType llmqType, const uint256& quorumHash) { - auto& params = Params().GetConsensus().llmqs.at(llmqType); - // sig shares and recovered sigs are only accepted from recent/active quorums // we allow one more active quorum as specified in consensus, as otherwise there is a small window where things could // fail while we are on the brink of a new quorum - auto quorums = quorumManager->ScanQuorums(llmqType, (int)params.signingActiveQuorumCount + 1); + auto quorums = quorumManager->ScanQuorums(llmqType, GetLLMQParams(llmqType).signingActiveQuorumCount + 1); for (const auto& q : quorums) { if (q->qc->quorumHash == quorumHash) { return true; diff --git a/src/rpc/rpcquorums.cpp b/src/rpc/rpcquorums.cpp index e5ba83f49e..f7fc2f296e 100644 --- a/src/rpc/rpcquorums.cpp +++ b/src/rpc/rpcquorums.cpp @@ -66,15 +66,15 @@ static UniValue quorum_list(const JSONRPCRequest& request) } for (auto& type : llmq::CLLMQUtils::GetEnabledQuorumTypes(pindexTip)) { - const auto& params = llmq::GetLLMQParams(type); + const auto& llmq_params = llmq::GetLLMQParams(type); UniValue v(UniValue::VARR); - auto quorums = llmq::quorumManager->ScanQuorums(type, pindexTip, count > -1 ? count : params.signingActiveQuorumCount); + auto quorums = llmq::quorumManager->ScanQuorums(type, pindexTip, count > -1 ? count : llmq_params.signingActiveQuorumCount); for (auto& q : quorums) { v.push_back(q->qc->quorumHash.ToString()); } - ret.pushKV(params.name, v); + ret.pushKV(llmq_params.name, v); } @@ -194,16 +194,16 @@ static UniValue quorum_dkgstatus(const JSONRPCRequest& request) UniValue minableCommitments(UniValue::VOBJ); UniValue quorumConnections(UniValue::VOBJ); for (const auto& type : llmq::CLLMQUtils::GetEnabledQuorumTypes(pindexTip)) { - const auto& params = llmq::GetLLMQParams(type); + const auto& llmq_params = llmq::GetLLMQParams(type); if (fMasternodeMode) { const CBlockIndex* pindexQuorum; { LOCK(cs_main); - pindexQuorum = chainActive[tipHeight - (tipHeight % params.dkgInterval)]; + pindexQuorum = chainActive[tipHeight - (tipHeight % llmq_params.dkgInterval)]; } - auto allConnections = llmq::CLLMQUtils::GetQuorumConnections(params.type, pindexQuorum, activeMasternodeInfo.proTxHash, false); - auto outboundConnections = llmq::CLLMQUtils::GetQuorumConnections(params.type, pindexQuorum, activeMasternodeInfo.proTxHash, true); + auto allConnections = llmq::CLLMQUtils::GetQuorumConnections(llmq_params.type, pindexQuorum, activeMasternodeInfo.proTxHash, false); + auto outboundConnections = llmq::CLLMQUtils::GetQuorumConnections(llmq_params.type, pindexQuorum, activeMasternodeInfo.proTxHash, true); std::map foundConnections; g_connman->ForEachNode([&](const CNode* pnode) { if (!pnode->verifiedProRegTxHash.IsNull() && allConnections.count(pnode->verifiedProRegTxHash)) { @@ -223,16 +223,16 @@ static UniValue quorum_dkgstatus(const JSONRPCRequest& request) obj.pushKV("outbound", outboundConnections.count(ec) != 0); arr.push_back(obj); } - quorumConnections.pushKV(params.name, arr); + quorumConnections.pushKV(llmq_params.name, arr); } LOCK(cs_main); llmq::CFinalCommitment fqc; - if (llmq::quorumBlockProcessor->GetMineableCommitment(params.type, + if (llmq::quorumBlockProcessor->GetMineableCommitment(llmq_params.type, tipHeight, fqc)) { UniValue obj(UniValue::VOBJ); fqc.ToJson(obj); - minableCommitments.pushKV(params.name, obj); + minableCommitments.pushKV(llmq_params.name, obj); } } @@ -284,12 +284,12 @@ static UniValue quorum_memberof(const JSONRPCRequest& request) UniValue result(UniValue::VARR); for (const auto& type : llmq::CLLMQUtils::GetEnabledQuorumTypes(pindexTip)) { - const auto& params = llmq::GetLLMQParams(type); - size_t count = params.signingActiveQuorumCount; + const auto& llmq_params = llmq::GetLLMQParams(type); + size_t count = llmq_params.signingActiveQuorumCount; if (scanQuorumsCount != -1) { count = (size_t)scanQuorumsCount; } - auto quorums = llmq::quorumManager->ScanQuorums(params.type, count); + auto quorums = llmq::quorumManager->ScanQuorums(llmq_params.type, count); for (auto& quorum : quorums) { if (quorum->IsMember(dmn->proTxHash)) { auto json = BuildQuorumInfo(quorum, false, false); @@ -457,7 +457,7 @@ static UniValue quorum_sigs_cmd(const JSONRPCRequest& request) signHeight = ParseInt32V(request.params[6], "signHeight"); } // First check against the current active set, if it fails check against the last active set - int signOffset{Params().GetConsensus().llmqs.at(llmqType).dkgInterval}; + int signOffset{llmq::GetLLMQParams(llmqType).dkgInterval}; return llmq::quorumSigningManager->VerifyRecoveredSig(llmqType, signHeight, id, msgHash, sig, 0) || llmq::quorumSigningManager->VerifyRecoveredSig(llmqType, signHeight, id, msgHash, sig, signOffset); } else { @@ -769,7 +769,7 @@ static UniValue verifyislock(const JSONRPCRequest& request) auto llmqType = Params().GetConsensus().llmqTypeInstantSend; // First check against the current active set, if it fails check against the last active set - int signOffset{Params().GetConsensus().llmqs.at(llmqType).dkgInterval}; + int signOffset{llmq::GetLLMQParams(llmqType).dkgInterval}; return llmq::quorumSigningManager->VerifyRecoveredSig(llmqType, signHeight, id, txid, sig, 0) || llmq::quorumSigningManager->VerifyRecoveredSig(llmqType, signHeight, id, txid, sig, signOffset); }