@@ -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