Skip to content

Publish our commitment when a funding candidate confirms after mutual close - #71

Merged
kwsantiago merged 2 commits into
blake2b-unifiedfrom
splice-close-awaiting
Oct 27, 2026
Merged

kwsantiago merged 2 commits into
blake2b-unifiedfrom
splice-close-awaiting

Conversation

@kwsantiago

Copy link
Copy Markdown

After a mutual close, lightningd watches each pending funding candidate (a splice, or an earlier dual-funding attempt) and force closes if one of them confirms instead of the close. The callback passed the candidate's transaction to the failure path as if it were a commitment that had already closed the channel, so drop_to_chain() logged "Not dropping our unilateral close onchain" and published nothing. The channel stayed in CLOSINGD_COMPLETE with its funds in an output nothing was watching, until a restart.

The callback now adopts the candidate the same way funding_spent() does (crediting the splice amount and saving the channel), then fails the channel without a transaction, so our commitment on the new funding output is published. It does nothing if the candidate was already adopted, for example when a reorg mines it again.

channel_apply_scid() no longer changes an existing scid once the channel is closing. After a restart, the funding watch on the adopted output computed a new scid, and changing it on a channel gossip already considers dying logged a broken gossip state transition.

Tests:

  • test_splice_confirms_after_mutual_close (v1 and dual-funded): a splice confirms in place of the mutual close; checks the funding, the balance including the splice-in, a restart within the rescan window, a restart past it that rebroadcasts our commitment, and the onchain resolution. It fails without this change.
  • test_rbf_candidate_confirms_after_mutual_close: the first dual-funding attempt confirms in place of the bump the close spends. It fails without this change.

Changelog-None

@kwsantiago
kwsantiago merged commit f9d2610 into blake2b-unified Oct 27, 2026
88 of 91 checks passed
@kwsantiago
kwsantiago deleted the splice-close-awaiting branch October 27, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant