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

swaps: more clean-up, add comments, more sanity checks

Public commit record

What the developer wrote

Authored by SomberNight

50/100 · Thin
swaps: more clean-up, add comments, more sanity checks
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
The short version

What changed, and why it matters

This commit tightens safety checks in Electrum's submarine-swap (a way to move Bitcoin between on-chain and Lightning) code. It prevents the same payment hash or prepayment hash from being reused for different swaps, makes sure saved payment records aren't silently overwritten by conflicting data, and verifies the other party's refund public key before accepting a swap invoice. These are defensive hardening changes that reduce the chance of a malicious or buggy swap server/client confusing the wallet into paying or revealing funds incorrectly. The commit message does not call this a security fix, and there is no disclosed vulnerability or CVE.

Recommended action

Treat as a defensive hardening patch. Reviewers should verify that the new exceptions are handled by callers and do not introduce denial-of-service issues for legitimate users, and that the redeem-script pubkey check in server_add_swap_invoice correctly covers all script variants. No urgent security deployment is indicated by the commit alone, but the changes are appropriate for a normal release.

Security signals we found

01

Duplicate payment_hash/prepay_hash rejection added in multiple swap creation paths

02

PaymentInfo overwrite guard added to prevent conflicting records for same payment_hash

03

server_add_swap_invoice moved under swaps_lock and gained redeem-script pubkey validation

04

is_new assertion added to swap indexing to catch inconsistent re-registration

05

FIXME comment added noting that linking swap RPCs by RHASH and refundPublicKey would be safer with a session secret

Risk score

Why this scored 57/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/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.