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

fix: harden ambiguous payments (#4110)

Public commit record

What the developer wrote

Authored by Arc

80/100 · Strong
fix: harden ambiguous payments (#4110)

Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides an explanatory body✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit hardens how LNbits decides whether a Lightning payment succeeded, failed, or is still pending. Previously, many wallet adapters treated unclear or ambiguous provider responses (network errors, HTTP 500s, timeouts, malformed JSON, unknown swap states, etc.) as definite failures. That could let a user be refunded for a payment that actually went through, or let a payment be marked failed when it was only delayed. The patch makes almost all ambiguous responses 'pending' instead, only marking a payment as failed when the backend clearly rejected it before dispatching funds. It also fixes handling of checking IDs returned by backends and adds many tests for these edge cases.

Recommended action

Review and merge promptly; this is a defensive hardening patch that reduces financial-reconciliation risk. After deployment, monitor for an increase in payments stuck in PENDING state and ensure background payment-status polling/notification paths can resolve them correctly. Consider whether any adapters still default to failed on ambiguous conditions that were not covered by the patch.

Security signals we found

01

Payment state confusion: ambiguous responses previously classified as failures could lead to double-spend/refund scenarios.

02

Pre-dispatch vs post-dispatch error classification added across many wallet adapters.

03

HTTP status code whitelist introduced for definite request rejection (401/403/404/405).

04

gRPC/RPC error classification added for LND, Boltz, Core Lightning to distinguish validation errors from in-flight/interrupted payments.

05

checking_id handling changed so backend-provided IDs are persisted on success/pending instead of rejecting mismatches.

06

Large test expansion (test_wallet_payment_ambiguity.py) explicitly encodes expected pending/failed behavior.

07

Makefile OpenAPI target hardened (unrelated, minor reliability improvement).

Risk score

Why this scored 72/100

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