Skip to content

Fix stale pre-splice announcement_signatures during reestablish#4577

Merged
wpaulino merged 2 commits intolightningdevkit:mainfrom
jkczyz:2026-04-splice-interop-fixes
Apr 28, 2026
Merged

Fix stale pre-splice announcement_signatures during reestablish#4577
wpaulino merged 2 commits intolightningdevkit:mainfrom
jkczyz:2026-04-splice-interop-fixes

Conversation

@jkczyz
Copy link
Copy Markdown
Contributor

@jkczyz jkczyz commented Apr 23, 2026

Two related issues surfaced during interop testing against Eclair's splicing implementation, both around stale announcement_signatures when splice_locked is implicit — inferred from my_current_funding_locked in channel_reestablish. Either could force-close an otherwise healthy channel.

  • Send side: the reestablish handler called get_announcement_sigs before processing the inferred splice_locked, so if announcement_sigs_state == NotSent it emitted sigs over the pre-splice short_channel_id. The peer, having already promoted, would fail verification and force-close.

  • Receive side: the announcement_signatures handler treated a mismatched short_channel_id as a signature verification failure and force-closed. BOLT7 does not require closing; a peer can legitimately retransmit pre-splice sigs around promotion.

@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented Apr 23, 2026

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@jkczyz jkczyz self-assigned this Apr 23, 2026
@jkczyz jkczyz requested review from TheBlueMatt and wpaulino April 23, 2026 20:48
@ldk-claude-review-bot
Copy link
Copy Markdown
Collaborator

ldk-claude-review-bot commented Apr 23, 2026

The ordering is clear:

  1. Line 13319: responses.announcement_sigs (from reestablish) is processed via handle_channel_resumption — with the fix, this is None when promotion is pending
  2. Line 13376-13378: inferred_splice_locked is processed, which triggers internal_splice_lockedmaybe_promote_splice_funding → generates new announcement_sigs

The flow is correct. The fix properly skips pre-splice announcement_sigs and lets the promotion path generate the correct post-splice ones.

I've thoroughly reviewed every part of the diff. Both fixes are logically sound, and the tests cover the regression scenarios well. My prior review was accurate.

No issues found.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.17%. Comparing base (2313bd5) to head (80528b1).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channel.rs 77.77% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4577      +/-   ##
==========================================
+ Coverage   87.08%   87.17%   +0.08%     
==========================================
  Files         161      161              
  Lines      109255   109251       -4     
  Branches   109255   109251       -4     
==========================================
+ Hits        95147    95235      +88     
+ Misses      11627    11543      -84     
+ Partials     2481     2473       -8     
Flag Coverage Δ
fuzzing-fake-hashes 31.20% <0.00%> (+0.22%) ⬆️
fuzzing-real-hashes 22.91% <44.44%> (+0.26%) ⬆️
tests 86.23% <77.77%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ldk-reviews-bot
Copy link
Copy Markdown

🔔 1st Reminder

Hey @TheBlueMatt @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

1 similar comment
@ldk-reviews-bot
Copy link
Copy Markdown

🔔 1st Reminder

Hey @TheBlueMatt @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Copy link
Copy Markdown
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment

Comment thread lightning/src/ln/channel.rs Outdated
.map(|funding_locked| {
self.pending_funding()
.iter()
.any(|funding| funding.get_funding_txid() == Some(funding_locked.txid))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should work, but wouldn't the more correct check be against PendingFunding::sent_funding_txid?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you're right.

@jkczyz jkczyz force-pushed the 2026-04-splice-interop-fixes branch from 97e9bc2 to d3691fa Compare April 28, 2026 02:15
TheBlueMatt
TheBlueMatt previously approved these changes Apr 28, 2026
Comment thread lightning/src/ln/splicing_tests.rs Outdated
// path) rather than the pre-splice funding (via the reestablish handler).
let mut reconnect_args = ReconnectArgs::new(&nodes[0], &nodes[1]);
reconnect_args.expect_renegotiated_funding_locked_monitor_update = (true, true);
reconnect_args.send_announcement_sigs = (true, true);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This test is kinda lazy, we should actually test that we're sending the right one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

// an old `announcement_signatures` across a splice handoff.
let stale_sigs = msgs::AnnouncementSignatures {
channel_id,
short_channel_id: pre_splice_scid,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is fine, but is there an actual case where we can hit this that we can test rather than just testing the synthetic message?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, because the first commit fixes LDK. Eclair had a bug when trying to maintain backwards compatibility with the older protocol used with Phoenix. The spec says SHOULD send a warning but we were closing the channel. t-bast advised ignoring the message like they do.

jkczyz and others added 2 commits April 28, 2026 13:59
When a splice transaction confirms on both sides while peers are
disconnected, each peer's `channel_reestablish` carries
`my_current_funding_locked` with the splice txid. In the reestablish
handler, `get_announcement_sigs` was called before the inferred
`splice_locked` was processed and the splice was promoted, so
`self.funding` still pointed to the pre-splice scope. If
`announcement_sigs_state` was `NotSent`, the generated
`announcement_signatures` carried the pre-splice `short_channel_id`
and bitcoin key — which the peer (having already promoted via its own
inferred `splice_locked`) would verify against the post-splice
`UnsignedChannelAnnouncement`, failing the signature check and
force-closing.

Skip the pre-promotion call when `my_current_funding_locked` matches
the splice we've already confirmed — i.e. `pending_splice.sent_funding_txid`
is set and equals the peer's locked txid. `maybe_promote_splice_funding`
emits correct post-splice signatures after the inferred `splice_locked`
is processed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A peer may transmit `announcement_signatures` signed over a stale
`short_channel_id` — most plausibly a retransmission or a peer
implementation whose view hasn't caught up to our post-splice
promotion. Verifying such sigs against the current
`UnsignedChannelAnnouncement` (built from `self.funding`) always fails
the hash check, which previously produced a force-close.

BOLT lightningdevkit#7 does not require closing in this situation; the mismatch is
expected across splice handoffs. Short-circuit with
`ChannelError::Ignore` when `msg.short_channel_id` doesn't match the
current funding's scid, leaving the genuine invalid-signature paths
in place for sigs that actually target our current scid.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wpaulino wpaulino merged commit 42e198c into lightningdevkit:main Apr 28, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants