diff --git a/src/llmq/quorums_signing_shares.cpp b/src/llmq/quorums_signing_shares.cpp index 073e9a90b286..dfbe3d9351b8 100644 --- a/src/llmq/quorums_signing_shares.cpp +++ b/src/llmq/quorums_signing_shares.cpp @@ -675,18 +675,10 @@ void CSigSharesManager::ProcessSigShare(NodeId nodeId, const CSigShare& sigShare if (!sigShares.Add(sigShare.GetKey(), sigShare)) { return; } - sigSharesToAnnounce.Add(sigShare.GetKey(), true); - auto it = timeSeenForSessions.find(sigShare.GetSignHash()); - if (it == timeSeenForSessions.end()) { - auto t = GetTimeMillis(); - // insert first-seen and last-seen time - timeSeenForSessions.emplace(sigShare.GetSignHash(), std::make_pair(t, t)); - } else { - // update last-seen time - it->second.second = GetTimeMillis(); - } + // Update the time we've seen the last sigShare + timeSeenForSessions[sigShare.GetSignHash()] = GetTimeMillis(); if (!quorumNodes.empty()) { // don't announce and wait for other nodes to request this share and directly send it to them @@ -1214,10 +1206,9 @@ void CSigSharesManager::Cleanup() std::unordered_set timeoutSessions; for (auto& p : timeSeenForSessions) { auto& signHash = p.first; - int64_t firstSeenTime = p.second.first; - int64_t lastSeenTime = p.second.second; + int64_t lastSeenTime = p.second; - if (now - firstSeenTime >= SESSION_TOTAL_TIMEOUT || now - lastSeenTime >= SESSION_NEW_SHARES_TIMEOUT) { + if (now - lastSeenTime >= SESSION_NEW_SHARES_TIMEOUT) { timeoutSessions.emplace(signHash); } } diff --git a/src/llmq/quorums_signing_shares.h b/src/llmq/quorums_signing_shares.h index 72d18bf5056c..c8a4a3f2687e 100644 --- a/src/llmq/quorums_signing_shares.h +++ b/src/llmq/quorums_signing_shares.h @@ -329,7 +329,6 @@ class CSigSharesNodeState class CSigSharesManager : public CRecoveredSigsListener { static const int64_t SESSION_NEW_SHARES_TIMEOUT = 60 * 1000; - static const int64_t SESSION_TOTAL_TIMEOUT = 5 * 60 * 1000; static const int64_t SIG_SHARE_REQUEST_TIMEOUT = 5 * 1000; // we try to keep total message size below 10k @@ -347,8 +346,8 @@ class CSigSharesManager : public CRecoveredSigsListener SigShareMap sigShares; - // stores time of first and last receivedSigShare. Used to detect timeouts - std::unordered_map, StaticSaltedHasher> timeSeenForSessions; + // stores time of last receivedSigShare. Used to detect timeouts + std::unordered_map timeSeenForSessions; std::unordered_map nodeStates; SigShareMap> sigSharesRequested;