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

graphdb: fix backwards-compat for channel edge feature deserialization

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

93/100 · Strong
graphdb: fix backwards-compat for channel edge feature deserialization

This commit fixes a backwards compatibility issue that prevented nodes
from upgrading from v0.19.x to v0.20.x.

In v0.19.x, channel edge features were serialized as raw feature bytes
without a length prefix. In v0.20.x (commit 2f2845dfc), the serialization
changed to use Features.Encode() which adds a 2-byte big-endian length
prefix before the feature bits. The deserialization code was updated to
use Features.Decode() which expects this length prefix.

When v0.20.x reads a database created by v0.19.x, Decode() tries to read
a length prefix that doesn't exist, causing an EOF error:

unable to decode features: EOF

The fix adds a deserializeChanEdgeFeatures() helper that detects which
format is being read and decodes accordingly:

- New format (v0.20+): First 2 bytes encode the length of the remaining
bytes. Detected when uint16(bytes[0:2]) == len(bytes)-2.

- Legacy format (pre-v0.20): Raw feature bits without length prefix.
Uses DecodeBase256 with the known length.

The format detection is safe because in the legacy format, the first byte
always has at least one bit set (the serialization uses minimum bytes),
so the first two bytes can never encode a value equal to len-2.

Fixes #10528.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This is a database backwards-compatibility bug fix, not a security vulnerability. A previous version of LND changed how channel feature data is stored on disk, but the new code could not read old-format data. When users upgraded from v0.19.x to v0.20.x, the node would fail to read its own graph database and log an 'unable to decode features: EOF' error. The patch adds format detection so both old and new on-disk formats are accepted. There is no attacker-controlled path or remote exploit here.

Recommended action

No security action required. Operators upgrading from LND v0.19.x to v0.20.x should apply this patch (or use v0.20.1) to avoid graph database read failures. The change is safe to deploy and does not introduce a vulnerability.

Security signals we found

01

No security-relevant signals present

02

Backwards-compatibility fix for on-disk serialization format

03

No input from untrusted network sources is parsed by the changed code

04

Failure mode is a local EOF error during node startup/graph load

Risk score

Why this scored 29/100

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