Skip to content

tapchannel: derive initial commitment from negotiated configs behind feature bit - #2278

Merged
jtobin merged 3 commits into
lightninglabs:mainfrom
GeorgeTsagk:negotiated-chan-cfg-bit
Sep 4, 2026
Merged

jtobin merged 3 commits into
lightninglabs:mainfrom
GeorgeTsagk:negotiated-chan-cfg-bit

Conversation

@GeorgeTsagk

Copy link
Copy Markdown
Member

Description

lightningnetwork/lnd#10804 hands the aux funding controller the negotiated
local and remote channel configs when the initial commitment is derived.
That makes the height zero state consistent with what is re-derived on an
immediate force close, but it also changes the commitment we build at
funding time. Peers on older versions still derive it from zeroed configs,
so funding a channel between a node on lnd master and a v0.8.0 node fails
with counterparty's commitment signature is invalid (the Compat Tests
job on #2177 shows this).

This PR bumps lnd to a master commit that includes #10804 and gates the new
derivation behind an aux channel feature bit:

  • negotiated-chan-cfg (bits 4/5) is added to tapfeatures and advertised
    as optional.
  • If the peer signals it, the configs are used as handed by lnd.
  • If the peer doesn't, both configs are zeroed before the initial
    commitment is derived. That is exactly what older lnd passed at that
    point, so both sides arrive at the same commitment transaction.
  • If we advertise the feature as required and the peer lacks it, the
    funding flow fails with ErrNegotiatedChanCfgRequired. This path is
    inactive until the bit is flipped.

Phase 2 (next release) is a follow-up that moves the bit to required. At
that point peers without it are rejected at init by checkRequiredBits,
with the funding check as a second line of defence.

Manually verified with the bit flipped to required: a v0.8.0 peer is
dropped at connect time with peer does not support required feature: negotiated-chan-cfg, new to new channels keep working.

Needed by #2177 (its compat job goes green once this lands).

Testing

  • Unit tests for the decision helper across all local/peer bit
    combinations, plus a guard that the bit is advertised as optional.
  • TestBackwardsCompatChannels (v0.8.0 vs tip) passes again and takes the
    zeroed config path.
  • TestCustomChannels/force_close passes without touching the fallback.

The aux funding controller is now handed the negotiated local and
remote channel configs when it derives the initial commitment.
Signals that the initial commitment of an asset channel is derived
from the negotiated local and remote channel configs. Advertised as
optional for now, the next release makes it required.
Older peers derive the initial commitment from zeroed channel configs,
as that is what lnd used to hand out at funding time. To arrive at the
same commitment transaction we do the same for peers that don't signal
the negotiated-chan-cfg feature. Once we advertise the feature as
required, such peers fail the funding flow instead.

@jtobin jtobin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍 👍

re-derived on an immediate force close. A new aux channel feature bit,
`negotiated-chan-cfg`, is advertised as optional. When a peer doesn't
signal it, the previous derivation from zeroed configs is used so that
channels can still be opened with older versions. The next release

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I made a v0.10 milestone; we should create an issue re: making this feature required, and then lump it under that, so as not to forget.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #2288 as a draft for the flip, on the v0.10 milestone.

@github-project-automation github-project-automation Bot moved this from 🆕 New to 👀 In review in Taproot-Assets Project Board Sep 4, 2026
@jtobin
jtobin added this pull request to the merge queue Sep 4, 2026
Merged via the queue into lightninglabs:main with commit 52ebeaf Sep 4, 2026
44 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Taproot-Assets Project Board Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants