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

Merge pull request #10853 from f321x/swapserver_negative_nonce

Public commit record

What the developer wrote

Authored by ghost43

73/100 · Adequate
Merge pull request #10853 from f321x/swapserver_negative_nonce

swaps: handle negative PoW nonce gracefully
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This patch fixes a small bug in how Electrum checks proof-of-work (PoW) nonces from Nostr swap server announcements. Previously, a missing or negative nonce was treated as having zero PoW, which is correct for missing nonces but the code also allowed negative nonces to be passed into the hash calculation. The patch now explicitly rejects negative nonces and moves the PoW check inside the try block so any parsing error skips the announcement. In practical terms, a malicious or buggy swap server could have advertised a negative nonce; depending on the exact behavior of the hash function with negative numbers, this could have caused a crash, incorrect PoW evaluation, or unexpected filtering of swap servers.

Recommended action

Treat this as a low-to-moderate hardening fix. Users running versions before this merge should upgrade if they use submarine swaps / Nostr-based swap server discovery. Developers should audit whether negative or malformed nonces could have reached any other hash helpers and add unit tests for boundary nonce values.

Security signals we found

01

Input validation gap: negative PoW nonce accepted

02

Potential DoS/crash due to unexpected negative value in cryptographic hash path

03

Validation moved into exception-handled parsing block

04

Submarine swap server discovery relies on client-side PoW filtering

Risk score

Why this scored 49/100

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