throw when subscription is created without filters.

fixes https://github.com/nbd-wtf/nostr-tools/pull/497
This commit is contained in:
fiatjaf
2025-11-18 08:09:44 -03:00
parent f5d0c0eb0f
commit 5841b0936b

View File

@@ -481,6 +481,8 @@ export class Subscription {
private eoseTimeoutHandle: ReturnType<typeof setTimeout> | 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