diff options
| author | Adam Soltys <[email protected]> | 2024-10-08 21:22:45 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-10 12:17:05 -0700 |
| commit | c0bfa4a8a45415e16ef335219c84632f4c04f97d (patch) | |
| tree | 3500e42303c80314841a217a8e12f3c8f864e31d /lib | |
| parent | 0a2734dfb5ae312f5283f93ab2e3f819ace3f94b (diff) | |
| download | coinos-server-c0bfa4a8a45415e16ef335219c84632f4c04f97d.tar.gz coinos-server-c0bfa4a8a45415e16ef335219c84632f4c04f97d.zip | |
use primal cache
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/nostr.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/nostr.ts b/lib/nostr.ts index a1a9a245..ca09649c 100644 --- a/lib/nostr.ts +++ b/lib/nostr.ts @@ -4,13 +4,14 @@ import { l } from "$lib/logging"; import { fail } from "$lib/utils"; import { nip19, finalizeEvent, getPublicKey } from "nostr-tools"; import { Relay } from "nostr-tools/relay"; -import { SimplePool } from "nostr-tools"; +import { AbstractSimplePool } from "nostr-tools/abstract-pool"; export const serverPubkey = getPublicKey( nip19.decode(config.nostrKey).data as Uint8Array, ); -export let pool = new SimplePool(); +let alwaysTrue: any = (t: Event) => { t[Symbol("verified")] = true; return true; }; +export let pool = new AbstractSimplePool({ verifyEvent: alwaysTrue }); export async function send(ev, url = config.nostr) { if (!(ev && ev.id)) return; @@ -90,11 +91,10 @@ export let getRelays = async (pubkey): Promise<any> => { let filter = { authors: [pubkey], kinds: [10002] }; let event = await pool.get([config.nostr], filter); - let read = relays; - let write = relays; + let read = relays; + let write = relays; if (event) { - read = []; write = []; for (let r of event.tags) { |
