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

open_channel_just_in_time: add cleanup and broadcast retry

Public commit record

What the developer wrote

Authored by f321x

73/100 · Adequate
open_channel_just_in_time: add cleanup and broadcast retry

Adds cleanup logic to `LNWallet.open_channel_just_in_time` so
that the channel provider removes unfunded channels again, e.g. if
the client didn't release the preimage or the provider failed
to broadcast the funding transaction.

Also adds more robust transaction broadcast logic so we retry to
broadcast if it failed and check against adb to see if any previous
broadcast was successful.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit hardens Electrum's 'just-in-time' Lightning channel opening. It makes the service provider automatically clean up half-open channels if the payment fails, and retry broadcasting the funding transaction more reliably. The main risk being fixed is that a provider could get stuck with an unfunded channel or lose track of whether the funding transaction was actually sent, which could lead to lost funds or service disruption.

Recommended action

Review the trust assumptions around the Electrum server used by JIT channel providers, as the commit itself flags this as a remaining risk. Ensure the new cleanup path cannot race with a concurrent successful broadcast. Consider adding tests for the retry/cleanup paths.

Security signals we found

01

Adds cleanup of unfunded JIT channels to prevent stranded channel state

02

Adds broadcast retry and adb-based confirmation to avoid false negatives from broadcast errors

03

Adds explicit security comment warning that untrusted Electrum servers could omit a broadcast from the provider, risking funds

04

Raises OnionRoutingFailure with INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS if funding tx cannot be broadcast

05

Prevents deletion of channels whose funding tx is already on-chain

Risk score

Why this scored 42/100

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