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

wallet: check swap provider liquidity for send change to ln

Public commit record

What the developer wrote

Authored by f321x

85/100 · Strong
wallet: check swap provider liquidity for send change to ln

Check the swap providers liquidity as well if we try to send change to
lightning in `make_unsigned_transaction`. It is now expected that the
swap_manager is already initialized when calling
`make_unsigned_transaction`, otherwise no dummy output will get added.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit tightens the conditions under which Electrum automatically sends Bitcoin transaction change into a Lightning Network swap. Previously, the wallet only checked whether the Lightning node could receive the amount. Now it also verifies the swap provider actually has enough liquidity and that the amount meets minimum and maximum swap limits. Without this check, a user could create a transaction whose change is routed into a swap that cannot currently be fulfilled, potentially leaving funds stuck, failing the payment path, or producing a poor user experience. The change is defensive rather than a fix for an active exploit.

Recommended action

Treat as a hardening or bug-fix patch. Review whether any callers of `make_unsigned_transaction` with `send_change_to_lightning=True` need to be updated to ensure the swap manager is initialized first, as the commit message warns that otherwise the swap change output will silently not be added. Users relying on automatic change-to-Lightning should upgrade to avoid creating transactions with unfulfillable swap outputs.

Security signals we found

01

Business-logic validation added for swap provider liquidity bounds

02

Precondition introduced: swap_manager must be initialized before change-to-lightning conversion

03

Change output replacement now gated on both local LN receive capacity and remote swap limits

04

Potential for failed/stuck swaps or unexpected transaction composition if preconditions are not met

Risk score

Why this scored 46/100

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