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

lnchannel: fix update_unfunded_state, add unittest

Public commit record

What the developer wrote

Authored by f321x

73/100 · Adequate
lnchannel: fix update_unfunded_state, add unittest

Fixes AbstractChannel.update_unfunded_state to stop calling a
non-existent method (unwatch_channel).
Adds unittest to execute the zeroconf path of update_unfunded_state.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in Electrum's Lightning code that handled 'zeroconf' channels—channels that are usable before their funding transaction is confirmed on the Bitcoin blockchain. The old code would crash because it tried to call a method that no longer exists, and it could also remove a channel too early or leave a user exposed to a scamming payment provider. The fix makes the code more careful: it waits until the wallet is fully synced, freezes the channel so it isn't advertised for receiving more payments, and only removes the channel after a longer timeout. It also adds a unit test to cover this code path.

Recommended action

Reviewers should verify that the new early-return conditions (wallet up-to-date, network present, tip not stale) cannot be abused to keep a malicious unfunded zeroconf channel alive indefinitely, and that the freeze/unfreeze logic correctly prevents routing hints without breaking legitimate payment receipt once funded. The unit test should be run to confirm the fix.

Security signals we found

01

Fixes call to non-existent method (unwatch_channel) that would raise AttributeError and abort cleanup logic

02

Prevents premature deletion of unfunded zeroconf channels before wallet sync is confirmed

03

Freezes zeroconf channel for receiving after short timeout to limit exposure to scam JIT provider

04

Clears trusted zeroconf provider only when channel node_id matches configured trusted node

05

Delays channel removal until funding timeout (~2 weeks) instead of short zeroconf timeout

06

Adds regression test for the zeroconf update_unfunded_state path

Risk score

Why this scored 44/100

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