feat(nostr): persist self nostr relays — pull-loop correct when pairing is asymmetric (#227)#333
Merged
Merged
Conversation
…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>
Deploying wireup-landing with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 dedupedself.nostr_relays[]set (additive on the self block; composes with the existing slot fields).wire nostr pair/accept/fetch --relay Xnow records X (accept folds it into its existing relay-state RMW).relay::nostr_relays_from_peersunionsself.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: nostrpeer 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 warningsclean.🤖 Generated with Claude Code