From 21bf0eacdb183015ec98a298de9302d62aa7613b Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 8 Jun 2022 00:06:40 +0300 Subject: [PATCH] fix(llmq): Actually remove old masternode quorum connections (#4859) --- src/llmq/quorums.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/llmq/quorums.cpp b/src/llmq/quorums.cpp index d03c2bcd6d..eeb894ce23 100644 --- a/src/llmq/quorums.cpp +++ b/src/llmq/quorums.cpp @@ -291,13 +291,15 @@ void CQuorumManager::EnsureQuorumConnections(const Consensus::LLMQParams& llmqPa for (const auto& quorum : lastQuorums) { if (CLLMQUtils::EnsureQuorumConnections(llmqParams, quorum->m_quorum_base_block_index, WITH_LOCK(activeMasternodeInfoCs, return activeMasternodeInfo.proTxHash))) { - continue; - } - if (connmanQuorumsToDelete.count(quorum->qc->quorumHash) > 0) { - LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- removing masternodes quorum connections for quorum %s:\n", __func__, quorum->qc->quorumHash.ToString()); - g_connman->RemoveMasternodeQuorumNodes(llmqParams.type, quorum->qc->quorumHash); + if (connmanQuorumsToDelete.erase(quorum->qc->quorumHash) > 0) { + LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- llmqType[%d] h[%d] keeping mn quorum connections for quorum: [%d:%s]\n", __func__, int(llmqParams.type), pindexNew->nHeight, quorum->m_quorum_base_block_index->nHeight, quorum->m_quorum_base_block_index->GetBlockHash().ToString()); + } } } + for (const auto& quorumHash : connmanQuorumsToDelete) { + LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- removing masternodes quorum connections for quorum %s:\n", __func__, quorumHash.ToString()); + g_connman->RemoveMasternodeQuorumNodes(llmqParams.type, quorumHash); + } } CQuorumPtr CQuorumManager::BuildQuorumFromCommitment(const Consensus::LLMQType llmqType, const CBlockIndex* pQuorumBaseBlockIndex) const