nip46: bunker client should wait for the initial EOSE before sending any requests.

This commit is contained in:
fiatjaf
2026-05-19 20:43:39 -03:00
parent e259db5881
commit b70dd86e7c
+11 -8
View File
@@ -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
}