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

lightningd: refuse channels whose channel_id is already in use

Public commit record

What the developer wrote

Authored by cdecker

73/100 · Adequate
lightningd: refuse channels whose channel_id is already in use

A v1 channel_id is derived from the funding outpoint, which the peer
chooses and which we can't check until it confirms. We only refused an
outpoint already used by a live channel with the same peer, so a second
channel could end up sharing a forgotten channel's channel_id. When it
is closed too we abort in closed_channel_map_add() with
"Assertion `!closed_channel_map_getmatch_(...)' failed", and since the
channel is in the db, onchaind or a restart then crashes us again every
time.

Refuse to commit a channel whose channel_id is used by any live or closed
channel, in the fundee, funder and dual-funding paths, and allow
duplicates in the closed channel map so nodes which already have such
channels in their db can close and load them.

Changelog-Fixed: lightningd: a peer reusing a funding outpoint can no longer crash the node with a duplicate channel_id.
(cherry picked from commit 84bfdf4fe1f8176cf361d474a12df20cfa704778)
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This update fixes a crash bug in Core Lightning. A malicious or careless peer could open a new Lightning channel using the same funding transaction details as an old, forgotten channel. Because the channel ID is derived from those details, the new channel would share the same ID. When either channel later closed, the program hit an internal 'this should never happen' assertion and crashed, then kept crashing on restart because the duplicate ID was stored in the database. The fix refuses to commit any new channel whose ID is already used by a live or closed channel, and allows the database to hold duplicates for already-affected nodes so they can close and restart safely.

Recommended action

Upgrade to a release containing this commit. Nodes that have already encountered duplicate channel_id crashes should be able to start and close affected channels after applying this patch, thanks to the duplicates-allowed closed_channel_map. Monitor logs for 'channel_id already in use' or 'Funding outpoint already in use' messages indicating rejected duplicate open attempts.

Security signals we found

01

Remote peer can trigger an assertion abort and persistent crash-on-restart by reusing a funding outpoint

02

Denial-of-service via protocol-level channel open, no authentication bypass required

03

Fix adds explicit duplicate channel_id rejection across all channel-opening paths

04

Database-level change allows graceful recovery for nodes already affected

05

Changelog explicitly labels this as a fixed security/crash issue

Risk score

Why this scored 72/100

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