Skip to content

clightning: announce the onion port that forwards to the peer port - #358

Merged
prusnak merged 1 commit into
bitcoinix:masterfrom
ostermayer:clightning-announce-peer-onion-port
Dec 1, 2026
Merged

prusnak merged 1 commit into
bitcoinix:masterfrom
ostermayer:clightning-announce-peer-onion-port

Conversation

@ostermayer

Copy link
Copy Markdown
Collaborator

With a public clightning onion service, clightning announced the port of the first mapping of the onion service. When another mapping came first, for example one added with mkBefore, peers dialed a port that doesn't reach clightning. Now it picks the mapping to clightning's peer port, as lnd does. Without one, it falls back to the first mapping, so those configs announce the same port as before.

Item 10 of #316. The new testClightningAnnouncesPeerOnionPort check fails on master and when no mapping matches, and module-config passes. A mapping to another address on the same port still counts, as in lnd's lookup.

Claude Fable 5.2 triaged #316 and Claude Opus 5.5 wrote this. DeepSeek V4.1 Flash 1017 (max), Gemini 4 Carbon (high), Gemini 4 Neon (high), Claude Opus 5.5 (high) and GPT-6 Astra (max) reviewed it over two rounds. They found that the first test couldn't tell a match from the fallback, and that the fallback had to stay the first mapping.

@ostermayer ostermayer added the type: bug Behaviour is wrong vs. documented or intended label Nov 30, 2026
@github-actions github-actions Bot added area: ci .github/, test/, dev/ area: modules modules/ and pkgs/lib.nix labels Nov 30, 2026
@github-actions github-actions Bot added the size: XS 0–9 changed lines (additions + deletions) label Nov 30, 2026
@seberm seberm added this to the v0.2.2 milestone Nov 30, 2026

@sebsgent sebsgent left a comment

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.

LGTM, no must/should items.

Tested: merged with current master, module-config passes; with master's clightning.nix the new test fails (negative control); with no matching mapping the first mapping's port is still announced.

Assisted-by: Claude Code (Claude Opus 5.5)

@viberaven

Copy link
Copy Markdown
Contributor

Reviewed 0de68d52989b5646eb42c363a5fcfd175e4decc0.

No actionable findings. The lookup selects the peer-port mapping when an unrelated mapping comes first and preserves the existing first-mapping fallback when nothing matches.

Validation on x86_64-linux:

  • nix build --no-link .#checks.x86_64-linux.module-config — passed.
  • Nine focused configuration cases passed on the PR head and on a local merge with master 701f590e809191886461f9dfb1ce4e3553b889ef: default/custom external ports, an unrelated first mapping, a custom peer port, an omitted target, no matching target, private/disabled onion services, and no announcement.
  • Negative control against the base revision reproduced the incorrect :8443 announcement; the PR announces :9999 for the regression fixture. Custom-peer-port and omitted-target cases also changed to their expected ports.

GitHub CI is green for the reviewed head. Validation here was configuration-level; I did not run live Tor or VM integration tests.

@prusnak
prusnak enabled auto-merge December 1, 2026 14:33
clightning announced the port of the first mapping of its onion
service. When another mapping came first, peers dialed a port that
doesn't reach clightning. Pick the mapping to the peer port, as lnd
does. Without one, fall back to the first mapping, as before.

Assisted-by: Claude Code (Claude Opus 5.5)
@prusnak
prusnak force-pushed the clightning-announce-peer-onion-port branch from 0de68d5 to 054f086 Compare December 1, 2026 14:53
@prusnak
prusnak merged commit 782c457 into bitcoinix:master Dec 1, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci .github/, test/, dev/ area: modules modules/ and pkgs/lib.nix size: XS 0–9 changed lines (additions + deletions) type: bug Behaviour is wrong vs. documented or intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants