Cleanup successful sessions before doing timeout check (#2712)

Otherwise we get some false-positive timeout messages in logs.
This commit is contained in:
Alexander Block 2019-02-18 12:07:57 +01:00 committed by UdjinM6
parent 26db020d17
commit 104c6e7767

View File

@ -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) {
@ -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);
});