Skip to content

Commit 0613978

Browse files
codablockpanleone
authored andcommitted
Cleanup successful sessions before doing timeout check (#2712)
Otherwise we get some false-positive timeout messages in logs.
1 parent c9127e1 commit 0613978

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/llmq/quorums_signing_shares.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,20 @@ void CSigSharesManager::Cleanup()
930930
{
931931
LOCK(cs);
932932

933+
// Remove sessions which were successfully recovered
934+
std::unordered_set<uint256> doneSessions;
935+
sigShares.ForEach([&](const SigShareKey& k, const CSigShare& sigShare) {
936+
if (doneSessions.count(sigShare.GetSignHash())) {
937+
return;
938+
}
939+
if (quorumSigningManager->HasRecoveredSigForSession(sigShare.GetSignHash())) {
940+
doneSessions.emplace(sigShare.GetSignHash());
941+
}
942+
});
943+
for (auto& signHash : doneSessions) {
944+
RemoveSigSharesForSession(signHash);
945+
}
946+
933947
// Remove sessions which timed out
934948
std::unordered_set<uint256> timeoutSessions;
935949
for (auto& p : firstSeenForSessions) {
@@ -957,20 +971,6 @@ void CSigSharesManager::Cleanup()
957971
RemoveSigSharesForSession(signHash);
958972
}
959973

960-
// Remove sessions which were successfully recovered
961-
std::unordered_set<uint256> doneSessions;
962-
sigShares.ForEach([&](const SigShareKey& k, const CSigShare& sigShare) {
963-
if (doneSessions.count(sigShare.GetSignHash())) {
964-
return;
965-
}
966-
if (quorumSigningManager->HasRecoveredSigForSession(sigShare.GetSignHash())) {
967-
doneSessions.emplace(sigShare.GetSignHash());
968-
}
969-
});
970-
for (auto& signHash : doneSessions) {
971-
RemoveSigSharesForSession(signHash);
972-
}
973-
974974
sigShares.ForEach([&](const SigShareKey& k, const CSigShare& sigShare) {
975975
quorumsToCheck.emplace((Consensus::LLMQType)sigShare.llmqType, sigShare.quorumHash);
976976
});

0 commit comments

Comments
 (0)