From b70dd86e7cc31272da54faad1861d4e2ae4caf26 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 19 May 2026 20:43:39 -0300 Subject: [PATCH] nip46: bunker client should wait for the initial EOSE before sending any requests. --- nip46/client.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/nip46/client.go b/nip46/client.go index d14c17c..9c26f8a 100644 --- a/nip46/client.go +++ b/nip46/client.go @@ -133,15 +133,16 @@ func NewBunker( cancellableCtx, cancel := context.WithCancel(ctx) _ = cancel + events, eosed := pool.SubscribeManyNotifyEOSE(cancellableCtx, relays, nostr.Filter{ + Tags: nostr.TagMap{"p": []string{clientPublicKey.Hex()}}, + Kinds: []nostr.Kind{nostr.KindNostrConnect}, + Since: now, + LimitZero: true, + }, nostr.SubscriptionOptions{ + Label: "bunker46client", + }) + go func() { - events := pool.SubscribeMany(cancellableCtx, relays, nostr.Filter{ - Tags: nostr.TagMap{"p": []string{clientPublicKey.Hex()}}, - Kinds: []nostr.Kind{nostr.KindNostrConnect}, - Since: now, - LimitZero: true, - }, nostr.SubscriptionOptions{ - Label: "bunker46client", - }) for ie := range events { if ie.Kind != nostr.KindNostrConnect { continue @@ -180,6 +181,8 @@ func NewBunker( } } + <-eosed + return bunker }