Skip to content

feat(nostr): persist self nostr relays — pull-loop correct when pairing is asymmetric (#227)#333

Merged
laulpogan merged 1 commit into
mainfrom
feat/nostr-self-relay-persist
Jun 16, 2026
Merged

feat(nostr): persist self nostr relays — pull-loop correct when pairing is asymmetric (#227)#333
laulpogan merged 1 commit into
mainfrom
feat/nostr-self-relay-persist

Conversation

@laulpogan

Copy link
Copy Markdown
Collaborator

What

Follow-up to #332 (the Nostr pull-loop). That pulled only from peers[*].nostr_transport.relay — the relays we reach peers on — which is correct only in the symmetric same-relay pairing. But a peer sends to us by publishing to a relay we're reachable on, not necessarily one we reach them on. This records that set.

How

  • endpoints::pin_self_nostr_relay / self_nostr_relays — a deduped self.nostr_relays[] set (additive on the self block; composes with the existing slot fields).
  • wire nostr pair/accept/fetch --relay X now records X (accept folds it into its existing relay-state RMW).
  • relay::nostr_relays_from_peers unions self.nostr_relays[] (authoritative — where peers publish our inbound) with the peer-transport relays (still covers the symmetric case before a self-relay is recorded).

Net: a transport: nostr peer round-trips regardless of pairing symmetry — closing the caveat #332 flagged.

Safety

Still additive: no nostr relay recorded → empty pull set → HTTP path byte-identical.

Tests

self_nostr_relay_roundtrips_and_dedups (roundtrip, dedup, empty, doesn't clobber other self keys); the relay-helper test now asserts the self∪peer union + dedup. 600 lib tests green; clippy -D warnings clean.

🤖 Generated with Claude Code

…en asymmetric

Follow-up to #332. The pull-loop pulled only from `peers[*].nostr_transport.relay`
(the relays we reach *peers* on), which is correct only when both sides paired
over the same relay. A peer sends to us by publishing to a relay *we're*
reachable on — not necessarily one we reach them on. So record that:

- `endpoints::pin_self_nostr_relay` / `self_nostr_relays` — a deduped
  `self.nostr_relays[]` set (additive on the self block; composes with the
  existing slot fields).
- `wire nostr pair`/`accept`/`fetch --relay X` now record X as a relay we're
  reachable on (accept folds it into its existing relay-state RMW).
- `relay::nostr_relays_from_peers` now unions `self.nostr_relays[]` (the
  authoritative "where peers publish our inbound" set) with the peer-transport
  relays (still covers the symmetric case before a self-relay is recorded).

Net: a `transport: nostr` peer round-trips regardless of pairing symmetry. Still
additive — no nostr relay recorded → empty pull set → HTTP path byte-identical.

Unit tests: `self_nostr_relay_roundtrips_and_dedups` (roundtrip, dedup, empty,
doesn't clobber other self keys) + the relay-helper test now asserts the
self∪peer union + dedup. 600 lib tests green; clippy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wireup-landing with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8335651
Status: ✅  Deploy successful!
Preview URL: https://0e04700f.wireup-landing.pages.dev
Branch Preview URL: https://feat-nostr-self-relay-persis.wireup-landing.pages.dev

View logs

@laulpogan laulpogan merged commit 51c28f7 into main Jun 16, 2026
13 checks passed
@laulpogan laulpogan deleted the feat/nostr-self-relay-persist branch June 16, 2026 06:07
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