From d577c51c740293e0aa6f4a382f160259f9e6d1b8 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 2 Apr 2024 19:36:40 -0500 Subject: [PATCH] PoolStore: don't publish to own relay --- src/storages/pool-store.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/storages/pool-store.ts b/src/storages/pool-store.ts index 8ec0cc9..ec32ab4 100644 --- a/src/storages/pool-store.ts +++ b/src/storages/pool-store.ts @@ -12,6 +12,7 @@ import { normalizeFilters } from '@/filter.ts'; import { purifyEvent } from '@/storages/hydrate.ts'; import { abortError } from '@/utils/abort.ts'; import { getRelays } from '@/utils/outbox.ts'; +import { Conf } from '@/config.ts'; interface PoolStoreOpts { pool: InstanceType; @@ -37,7 +38,11 @@ class PoolStore implements NStore { async event(event: NostrEvent, opts: NStoreOpts = {}): Promise { if (opts.signal?.aborted) return Promise.reject(abortError()); - const relays = [...await getRelays(event.pubkey)].slice(0, 4); + + const relaySet = await getRelays(event.pubkey); + relaySet.delete(Conf.relay); + + const relays = [...relaySet].slice(0, 4); event = purifyEvent(event); this.#debug('EVENT', event, relays);