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

lnwallet+chanstate: keep persisted HTLC data readable

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

73/100 · Adequate
lnwallet+chanstate: keep persisted HTLC data readable

In this commit, we tighten two invariants around the HTLC data we write
to disk.

First, we only attach aux signatures to an HTLC on taproot overlay
channels. The aux signer is configured node wide, so it also sees the
commit_sig of plain channels. Those channels never use aux signatures,
and the count check further down is already gated on the tapscript root
bit, but the attach step wasn't: any aux data unpacked for a plain
channel was copied into the HTLC's custom records and persisted with the
commitment.

Second, SerializeHtlcs now refuses to write an HTLC whose onion and extra
data exceed what ReadElement accepts for a variable length byte slice.
Before, the writer had no bound while the reader capped the field at
66,000 bytes, so an oversized HTLC was written without error but made
the whole channel unreadable on the next load. The reader's limit is now
a named constant that the writer checks against.
✓ 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 two bugs in how Lightning Network channel data is saved to disk. First, it stops extra 'aux' signatures meant only for advanced taproot channels from being saved on ordinary channels, where they don't belong. Second, it prevents a channel from being saved with an HTLC (a routed payment slot) whose attached data is too large to be read back later, which would previously have made the whole channel unrecoverable on restart.

Recommended action

Treat this as a hardening fix with availability impact. Review whether any existing channel databases contain plain-channel HTLCs with unexpected aux custom records, and consider backporting to supported release branches because the unreadable-state bug can lock user funds on restart.

Security signals we found

01

Persisted state could become unreadable due to writer/reader size mismatch

02

Auxiliary signatures for taproot overlay channels were persisted on plain channel HTLCs

03

Fix adds explicit serialization bound to prevent unreadable channel records

04

Fix gates aux-signature attachment on tapscript root channel type

Risk score

Why this scored 58/100

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