From 5841b0936beed868baad79438aaa162b8f541188 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 18 Nov 2025 08:09:44 -0300 Subject: [PATCH] throw when subscription is created without filters. fixes https://github.com/nbd-wtf/nostr-tools/pull/497 --- abstract-relay.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/abstract-relay.ts b/abstract-relay.ts index e8c88de..0f3b397 100644 --- a/abstract-relay.ts +++ b/abstract-relay.ts @@ -481,6 +481,8 @@ export class Subscription { private eoseTimeoutHandle: ReturnType | undefined constructor(relay: AbstractRelay, id: string, filters: Filter[], params: SubscriptionParams) { + if (filters.length === 0) throw new Error("subscription can't be created with zero filters") + this.relay = relay this.filters = filters this.id = id