AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 11 Bitcoin

Fix flaky `ReputationRecorder` test (#3166)

Public commit record

What the developer wrote

Authored by Thomas HUET

98/100 · Strong
Fix flaky `ReputationRecorder` test (#3166)

Sometimes, the test publishes events to the `EventStream` before the `ReputationRecorder` has subscribed, which leads to dropped events.
We fix this by bypassing the `EventStream` in tests.
We also subscribe to `OutgoingHtlcSettled` before subscribing to `OutgoingHtlcAdded` to prevent the unlikely edge case where a HTLC stays pending forever because it settled before `ReputationRecorder` subscribed to `OutgoingHtlcSettled`.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a flaky automated test and makes a tiny production-code ordering change. The main code now subscribes to 'HTLC settled' events before 'HTLC added' events, so a very brief race during startup cannot leave a payment stuck. The rest of the change only alters test code to avoid using the event bus in tests, which removes test flakiness. There is no direct evidence this is a security vulnerability or that it was exploited.

Recommended action

No urgent action. Treat as routine test reliability and minor hardening. Reviewers may verify the subscription ordering change does not break normal ReputationRecorder behavior under load.

Security signals we found

01

Race-condition mitigation in event subscription ordering

02

Test-only refactor to bypass EventStream

03

No input validation, cryptographic, or authorization changes

04

No memory safety, overflow, or injection patterns

Risk score

Why this scored 11/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 2/15
Confidence 3/10
Evidence quality 2/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.