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 panleone committed Oct 29, 2024
1 parent c9127e1 commit 0613978
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 @@ -930,6 +930,20 @@ void CSigSharesManager::Cleanup()
{
LOCK(cs);

// Remove sessions which were successfully 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 @@ -957,20 +971,6 @@ void CSigSharesManager::Cleanup()
RemoveSigSharesForSession(signHash);
}

// Remove sessions which were successfully 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 0613978

Please sign in to comment.