mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge pull request #4258 from PastaPastaPasta/refactor-llmq-params
refactor: utilize GetLLMQParams, make it const, consistent naming
This commit is contained in:
commit
b7d69e0375
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<std::string, Consensus::LLMQType, uint32_t> 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;
|
||||
}
|
||||
|
||||
|
@ -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<CBLSPublicKey> 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;
|
||||
}
|
||||
|
||||
|
@ -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<bool(CDKGDebugSessionStatus& status)>&& func)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
{
|
||||
|
@ -107,16 +107,16 @@ std::string CBatchedSigShares::ToInvString() const
|
||||
template<typename T>
|
||||
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_map<NodeId, std
|
||||
}
|
||||
auto& inv = (*invMap)[signHash];
|
||||
if (inv.inv.empty()) {
|
||||
const auto& params = Params().GetConsensus().llmqs.at(session.llmqType);
|
||||
inv.Init((size_t)params.size);
|
||||
inv.Init(GetLLMQParams(session.llmqType).size);
|
||||
}
|
||||
inv.inv[k.second] = true;
|
||||
|
||||
@ -1101,8 +1095,7 @@ void CSigSharesManager::CollectSigSharesToAnnounce(std::unordered_map<NodeId, st
|
||||
|
||||
auto& inv = sigSharesToAnnounce[nodeId][signHash];
|
||||
if (inv.inv.empty()) {
|
||||
const auto& params = Params().GetConsensus().llmqs.at(sigShare->llmqType);
|
||||
inv.Init((size_t)params.size);
|
||||
inv.Init(GetLLMQParams(sigShare->llmqType).size);
|
||||
}
|
||||
inv.inv[quorumMember] = true;
|
||||
session.knows.inv[quorumMember] = true;
|
||||
|
@ -42,10 +42,9 @@ std::vector<CDeterministicMNCPtr> 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;
|
||||
|
@ -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<uint256, CAddress> 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user