Skip to content

fix: restore missing returns in send_channel_announce_sigs#8986

Open
vincenzopalazzo wants to merge 2 commits intoElementsProject:masterfrom
vincenzopalazzo:claude/flamboyant-mclaren
Open

fix: restore missing returns in send_channel_announce_sigs#8986
vincenzopalazzo wants to merge 2 commits intoElementsProject:masterfrom
vincenzopalazzo:claude/flamboyant-mclaren

Conversation

@vincenzopalazzo
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo commented Mar 25, 2026

Summary

  • Peers disconnect immediately after channel reestablishment on v26.04rc1 (channeld exits with status 62208 / status_peer_connection_lost)
  • Root cause: commit 9fb10b8 removed all early-return statements from send_channel_announce_sigs() when converting from bool to void, and channel_gossip_channel_reestablished() called it directly bypassing the gossip state machine
  • Fix restores early returns, moves the sent_sigs guard into send_channel_announce_sigs(), and removes the unsafe direct call path

Detail

The send_channel_announce_sigs() function had three missing returns:

  1. After the !channel->reestablished check (logged but fell through)
  2. After channel_internal_error for invalid node signature
  3. After channel_internal_error for invalid bitcoin signature

Additionally, the announcement_sigs_requested parameter caused send_channel_announce_sigs() to be called directly (bypassing the state machine) when the peer set my_current_funding_locked TLV with retransmit_flags & 1. This sent unexpected announcement_signatures to the peer, causing it to drop the connection.

The bug only manifests between two v26.04rc1 peers because only v26.04rc1 sets the new my_current_funding_locked TLV.

Fixes #8978

Test plan

  • CI passes
  • Two v26.04 nodes can maintain stable channel connections after reestablishment
  • Channels in CGOSSIP_ANNOUNCED state no longer receive spurious announcement_signatures

Commit 9fb10b8 ("fixup! reestablish: Send announcement sigs when
asked") converted send_channel_announce_sigs() from bool to void but
removed all early-return statements. This causes the function to
unconditionally send announcement_signatures even when:

1. The channel hasn't finished reestablishment yet
2. The HSM returned invalid signatures (channel_internal_error was
   called but execution continued)

Additionally, channel_gossip_channel_reestablished() called
send_channel_announce_sigs() directly when announcement_sigs_requested
was true, bypassing the gossip state machine. This sent unexpected
announcement_signatures to the peer, causing the remote side to drop
the connection (channeld exits with status_peer_connection_lost/62208).

The bug only manifests between two v26.04rc1 peers because only
v26.04rc1 sets the my_current_funding_locked TLV with
retransmit_flags that triggers announcement_sigs_requested=true.

Fix by:
- Restoring early returns in send_channel_announce_sigs()
- Moving the sent_sigs guard into send_channel_announce_sigs() itself
- Removing the send_channel_announce_sigs_once() wrapper
- Removing the announcement_sigs_requested bypass that called
  send_channel_announce_sigs() outside the state machine

Fixes: ElementsProject#8978
Changelog-Fixed: Peers no longer disconnect immediately after channel reestablishment.
@vincenzopalazzo vincenzopalazzo force-pushed the claude/flamboyant-mclaren branch from 2d5c90d to be6c81a Compare March 25, 2026 13:52
Verify that a channel stays connected after disconnect/reconnect when
it has already fully exchanged announcement_signatures. The bug in
send_channel_announce_sigs() caused unconditional sending of
announcement_signatures on reconnect, making the peer drop the
connection.

Fixes: ElementsProject#8978
l1.daemon.wait_for_log('channel_gossip: reestablished')

# Channel must remain connected (the bug caused immediate disconnect)
import time
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is redundant.

Copy link
Collaborator

@sangbida sangbida left a comment

Choose a reason for hiding this comment

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

This looks good, just have a minor nit.

@madelinevibes madelinevibes added this to the v26.04 milestone Mar 26, 2026
@madelinevibes madelinevibes added 26.04 bug bug identified in the 26.04 CLN release. 26.04 RC This PR needs to go into the next release candidate for 26.04 labels Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

26.04 bug bug identified in the 26.04 CLN release. 26.04 RC This PR needs to go into the next release candidate for 26.04

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peers disconnect after upgrading to v26.04rc1

3 participants