Skip to content

Commit

Permalink
Cleanup successful sessions before doing timeout check (#2712)
Browse files Browse the repository at this point in the history
Otherwise we get some false-positive timeout messages in logs.
  • Loading branch information
codablock authored and UdjinM6 committed Feb 18, 2019
1 parent 26db020 commit 104c6e7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/llmq/quorums_signing_shares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,20 @@ void CSigSharesManager::Cleanup()
{
LOCK(cs);

// Remove sessions which were succesfully recovered
std::unordered_set<uint256> 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<uint256> timeoutSessions;
for (auto& p : firstSeenForSessions) {
Expand Down Expand Up @@ -969,20 +983,6 @@ void CSigSharesManager::Cleanup()
RemoveSigSharesForSession(signHash);
}

// Remove sessions which were succesfully recovered
std::unordered_set<uint256> 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);
});
Expand Down

0 comments on commit 104c6e7

Please sign in to comment.