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 }