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

multi: make RemoteNextRevocation an fn.Option

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

78/100 · Adequate
multi: make RemoteNextRevocation an fn.Option

In this commit, we change OpenChannel.RemoteNextRevocation and
ChannelCloseSummary.RemoteNextRevocation from a bare *btcec.PublicKey to
an fn.Option[btcec.PublicKey], and have
LightningChannel.RemoteNextRevocation return one as well. The remote
party's next revocation point is legitimately absent until they send
channel_ready (and, for taproot channels, until we have their nonces),
so the type should say so rather than leaving it to convention.

With an Option, code can no longer move the point into a field that
assumes it's always set without first deciding what to do when it's
absent. Every place that needs the point now has to unwrap it: the
revocation rotation, restoring a pending remote commitment, the anchor
resolution and chain watcher paths for a pending remote commitment, and
a retransmitted channel_ready in the peer. Each returns the new
ErrNoNextRevocation if it's missing. The presence checks in the funding
manager, link and peer become IsSome/IsNone.

We hold the key by value rather than by pointer, so a present point is
always a real key: there's no Some(nil) to fall into. In the same
spirit, InsertNextRevocation and InitNextRevocation now take the key by
value, which moves the only pointer dereference to the funding manager,
where the point comes straight off a decoded channel_ready message.

The on-disk format is unchanged. The revocation state still omits the
point when it's absent, and the close summary still writes a presence
flag ahead of it. The frozen migration packages keep their own copies of
these types, so they're untouched.

We add a round trip test for a channel with no next point, and for
close summaries with and without one. The peer test for a retransmitted
channel_ready previously passed a channel with no next point and
inserted an empty value. It now asserts that case is rejected, and that
a real point makes it into the peer's copy of the channel.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit is a defensive code-quality change in LND that makes the 'remote next revocation point' an explicit optional value instead of a bare pointer that could be nil. It forces every piece of code that needs the point to check whether it is actually present before using it, and returns a clear error (ErrNoNextRevocation) when it is missing. The on-disk database format is unchanged, and new tests are added for channels and close summaries that lack the point. The change reduces the risk of accidental nil-pointer use or logic bugs around channels that have not yet received channel_ready, but it is not a fix for a known active exploit.

Recommended action

Review as normal defensive hardening. No urgent patch or incident response is indicated by the commit itself. Operators and downstream integrators should ensure they are on a version that includes this refactor if they want the additional safety around pre-channel_ready state handling. Monitor release notes for any related follow-up fixes.

Security signals we found

01

Refactor from nullable pointer to explicit Option type to prevent accidental use of absent revocation point

02

New sentinel error ErrNoNextRevocation returned when the point is required but missing

03

Multiple call sites now require explicit unwrapping before using the revocation point

04

On-disk serialization format kept backward-compatible

05

New and updated tests cover absent next revocation point paths

Risk score

Why this scored 32/100

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