Skip to content

setchannel: allow upgrading private channels to public - #9405

Open
vincenzopalazzo wants to merge 1 commit into
ElementsProject:masterfrom
vincenzopalazzo:claude/vigilant-sammet
Open

setchannel: allow upgrading private channels to public#9405
vincenzopalazzo wants to merge 1 commit into
ElementsProject:masterfrom
vincenzopalazzo:claude/vigilant-sammet

Conversation

@vincenzopalazzo

Copy link
Copy Markdown
Collaborator

♻️ Re-creation of #8982, which was auto-closed on 2026-08-11 when my fork was detached from the repository network (GitHub cannot reopen PRs closed by a detachment). Branch content is unchanged (head 5ae3369d3); the previous review discussion remains on #8982.

Summary

  • Add announce parameter to setchannel RPC to upgrade private channels to public
  • When both peers set announce=true, the channel enters the public announcement flow (exchange announcement_signatures, wait for 6 confirmations, broadcast channel_announcement)
  • Announcement signatures received while a channel is private are now stashed instead of rejected, enabling seamless upgrade when the peer upgrades first

Details

The channel gossip state machine gains three new transitions from CGOSSIP_PRIVATE:

  • CGOSSIP_PRIVATE -> CGOSSIP_WAITING_FOR_MATCHING_PEER_SIGS (normal case)
  • CGOSSIP_PRIVATE -> CGOSSIP_WAITING_FOR_ANNOUNCE_DEPTH (peer sigs already received)
  • CGOSSIP_PRIVATE -> CGOSSIP_ANNOUNCED (peer sigs received + 6 confirms already reached)

Setting announce=false is rejected since public-to-private conversion is not possible.

Fixes #7438

Test plan

  • CI passes (build + unit tests)
  • Manual test: open private channel, call setchannel <id> announce=true on both sides, verify channel gets announced
  • Verify setchannel with announce=false returns error
  • Verify announcement_signatures from peer are stashed when channel is private

Add an `announce` parameter to the `setchannel` RPC command that allows
upgrading an existing private (unannounced) channel to a public
(announced) channel. When set to true, the channel_flags are updated
to set the CHANNEL_FLAGS_ANNOUNCE_CHANNEL bit, and the gossip state
machine transitions from the private states into the public announcement
flow.

Both peers must independently set announce=true for the channel
announcement to complete, as the protocol requires announcement
signatures from both sides. To facilitate this, announcement_signatures
received while a channel is still private are now stashed rather than
rejected, so they are available immediately if/when the local side
upgrades.

State transitions added:
- CGOSSIP_PRIVATE -> CGOSSIP_WAITING_FOR_MATCHING_PEER_SIGS
- CGOSSIP_PRIVATE -> CGOSSIP_WAITING_FOR_ANNOUNCE_DEPTH
- CGOSSIP_PRIVATE -> CGOSSIP_ANNOUNCED

Setting announce=false (public to private) is rejected as this is not
possible once a channel has been announced.

Changelog-Added: `setchannel` now accepts an `announce` parameter to upgrade private channels to public.
Fixes #7438
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.

Update an existing private channel into a public channel

1 participant