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

swaps: handle timeouts in send_direct_message

Public commit record

What the developer wrote

Authored by f321x

68/100 · Adequate
swaps: handle timeouts in send_direct_message

Adds logic to retry sending a direct message in
`NostrTransport.send_direct_message()` on `TimeoutError`.
Handles `TimeoutError` exception more gracefully by catching it and
returning `None`.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit improves how Electrum's submarine-swap feature handles network timeouts when sending direct messages over Nostr. Previously, a timeout while publishing a swap offer or sending an encrypted request could crash or hang the process. Now the code catches the timeout, logs a warning, optionally retries, and returns None if it still fails. Callers are updated to raise a proper SwapServerError instead of hanging. This is a robustness fix rather than a fix for a clear exploitable vulnerability.

Recommended action

Treat as a normal reliability/robustness improvement. Reviewers may want to verify that the recursive retry does not interact dangerously with cancellation or taskgroup shutdown, and that logging does not leak sensitive message content. No urgent security action is indicated by the diff alone.

Security signals we found

01

TimeoutError handling added to network publish operations

02

Recursive retry loop bounded by assertion (retries < 25)

03

send_request_to_server now raises SwapServerError on failure instead of hanging

04

Direct message sends moved to taskgroup.spawn to avoid blocking error paths

05

No cryptographic, authentication, or input-validation changes observed

Risk score

Why this scored 32/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 4/15
Affected reach 6/15
Confidence 6/10
Evidence quality 3/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.