PoolStore: don't publish to own relay

This commit is contained in:
Alex Gleason 2024-04-02 19:36:40 -05:00
parent 4e54589c09
commit d577c51c74
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 6 additions and 1 deletions

View File

@ -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<typeof RelayPoolWorker>;
@ -37,7 +38,11 @@ class PoolStore implements NStore {
async event(event: NostrEvent, opts: NStoreOpts = {}): Promise<void> {
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);