Skip to content

Commit 25e53e5

Browse files
committed
fix: revert nextAttemptTime back to mockable time, set next_deadline based on signedSessions emptiness
1 parent 42ee60d commit 25e53e5

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/llmq/signing_shares.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ void CSigSharesManager::CollectSigSharesToSendConcentrated(std::unordered_map<No
10291029
proTxToNode.try_emplace(verifiedProRegTxHash, pnode);
10301030
}
10311031

1032-
auto curTime = std::chrono::steady_clock::now();
1032+
auto curTime = NodeClock::now();
10331033

10341034
for (auto& [_, signedSession] : signedSessions) {
10351035
if (!IsAllMembersConnectedEnabled(signedSession.quorum->params.type, m_sporkman)) {
@@ -1527,14 +1527,9 @@ void CSigSharesManager::WorkThreadMain(CConnman& connman, PeerManager& peerman)
15271527
}
15281528
}
15291529
{
1530-
// Consider next recovery attempt times for signed sessions to avoid polling
15311530
LOCK(cs);
1532-
auto now_steady = std::chrono::steady_clock::now();
1533-
for (const auto& [_, s] : signedSessions) {
1534-
if (s.nextAttemptTime > now_steady) {
1535-
if (s.nextAttemptTime < next_deadline) next_deadline = s.nextAttemptTime;
1536-
}
1537-
}
1531+
next_deadline = std::chrono::steady_clock::now() +
1532+
(signedSessions.empty() ? std::chrono::seconds(5) : std::chrono::milliseconds(100));
15381533
}
15391534

15401535
// Wait event-driven until notified or deadline reached, or interrupted
@@ -1577,7 +1572,7 @@ void CSigSharesManager::SignPendingSigShares(const CConnman& connman, PeerManage
15771572
auto& session = signedSessions[sigShare.GetSignHash()];
15781573
session.sigShare = sigShare;
15791574
session.quorum = pQuorum;
1580-
session.nextAttemptTime = std::chrono::steady_clock::time_point{};
1575+
session.nextAttemptTime = NodeClock::time_point{};
15811576
session.attempt = 0;
15821577
}
15831578
}

src/llmq/signing_shares.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class CSignedSession
355355
CSigShare sigShare;
356356
CQuorumCPtr quorum;
357357

358-
std::chrono::steady_clock::time_point nextAttemptTime{};
358+
NodeClock::time_point nextAttemptTime{};
359359
int attempt{0};
360360
};
361361

0 commit comments

Comments
 (0)