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

lnwallet: reject initial commitments that leave a channel unusable

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

95/100 · Strong
lnwallet: reject initial commitments that leave a channel unusable

In this commit, we replace the single balance check on the initial commitment
with the two checks that decide whether such a channel could ever be used:
the BOLT-02 requirement the receiver of open_channel MUST apply, and a
comparison of each output against the reserve its own side must maintain.

The first is the spec's, and it is what the previous revision of this commit
did alone. The spec measures both to_local and to_remote against the single
channel_reserve_satoshis the initiator named in open_channel, which is the
reserve the initiator requires of us. It stays because it is a MUST, even
though it can reject a channel the initiator could still spend on: that
happens when the reserve we name in accept_channel is the lower of the two,
and the spec requires the rejection anyway. That case is pinned by a test so
a later change cannot drop it by accident.

The second is additive. It compares to_local against the reserve the
initiator named for us and to_remote against the reserve we named for them in
accept_channel, which is exactly the condition under which neither side can
add an HTLC. The two reserves are independent, so this is not the same check
as the first, and neither implies the other: it catches the channel the spec
comparison accepts where neither side can spend, for example an initiator
naming a minimal reserve of us while its own balance lands at or below the
reserve we require of it.

That second check is a local policy, in places stricter than the letter of
the spec, and is deliberately additive rather than a reinterpretation of the
first. It costs us no usable channel: every rejection it contributes beyond
the spec's is a channel where neither side can spend, which the property test
asserts directly.

Both checks run in handleSingleContribution rather than in
NewChannelReservation, as that's the first point where both reserves are
known: the one the initiator imposes on us arrives in open_channel, while the
one we impose on them is only settled once the channel acceptor (which may
override our default) has had its say.

The error carries a sentinel the funding manager can match on, so the decision
does not depend on the wording of the message we send the peer.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit tightens the rules LND uses when accepting a new Lightning channel. Before, LND only applied one BOLT-02 check on opening balances. Now it also rejects channels where, because of each side's reserve setting, neither party could ever send a payment. The change prevents 'dead on arrival' channels that look valid to the spec but cannot actually be used. It is a defensive policy fix, not a response to a disclosed vulnerability or active exploit.

Recommended action

Treat as a hardening/policy improvement. Reviewers should confirm the new usability check does not break legitimate funding flows with asymmetric reserves, and that the funding manager handles ErrBalancesBelowReserveBase appropriately. No urgent security patch is indicated by the diff alone.

Security signals we found

01

Defensive validation added to funding flow

02

New sentinel error supports programmatic rejection handling

03

BOLT-02 spec compliance enforced plus stricter local policy

04

Prevents unusable channels from being locked on-chain

05

No memory-safety, cryptographic, or remote-execution signals present

Risk score

Why this scored 47/100

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