From 0613978bfd9a6d712587426533229ffe1cc56ad7 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Mon, 18 Feb 2019 12:07:57 +0100 Subject: [PATCH] Cleanup successful sessions before doing timeout check (#2712) Otherwise we get some false-positive timeout messages in logs. --- src/llmq/quorums_signing_shares.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/llmq/quorums_signing_shares.cpp b/src/llmq/quorums_signing_shares.cpp index 6f0314b6a2318..78782e2e60045 100644 --- a/src/llmq/quorums_signing_shares.cpp +++ b/src/llmq/quorums_signing_shares.cpp @@ -930,6 +930,20 @@ void CSigSharesManager::Cleanup() { LOCK(cs); + // Remove sessions which were successfully recovered + std::unordered_set doneSessions; + sigShares.ForEach([&](const SigShareKey& k, const CSigShare& sigShare) { + if (doneSessions.count(sigShare.GetSignHash())) { + return; + } + if (quorumSigningManager->HasRecoveredSigForSession(sigShare.GetSignHash())) { + doneSessions.emplace(sigShare.GetSignHash()); + } + }); + for (auto& signHash : doneSessions) { + RemoveSigSharesForSession(signHash); + } + // Remove sessions which timed out std::unordered_set timeoutSessions; for (auto& p : firstSeenForSessions) { @@ -957,20 +971,6 @@ void CSigSharesManager::Cleanup() RemoveSigSharesForSession(signHash); } - // Remove sessions which were successfully recovered - std::unordered_set doneSessions; - sigShares.ForEach([&](const SigShareKey& k, const CSigShare& sigShare) { - if (doneSessions.count(sigShare.GetSignHash())) { - return; - } - if (quorumSigningManager->HasRecoveredSigForSession(sigShare.GetSignHash())) { - doneSessions.emplace(sigShare.GetSignHash()); - } - }); - for (auto& signHash : doneSessions) { - RemoveSigSharesForSession(signHash); - } - sigShares.ForEach([&](const SigShareKey& k, const CSigShare& sigShare) { quorumsToCheck.emplace((Consensus::LLMQType)sigShare.llmqType, sigShare.quorumHash); });