nip46: bunker client should wait for the initial EOSE before sending any requests.
This commit is contained in:
+5
-2
@@ -133,8 +133,7 @@ func NewBunker(
|
|||||||
cancellableCtx, cancel := context.WithCancel(ctx)
|
cancellableCtx, cancel := context.WithCancel(ctx)
|
||||||
_ = cancel
|
_ = cancel
|
||||||
|
|
||||||
go func() {
|
events, eosed := pool.SubscribeManyNotifyEOSE(cancellableCtx, relays, nostr.Filter{
|
||||||
events := pool.SubscribeMany(cancellableCtx, relays, nostr.Filter{
|
|
||||||
Tags: nostr.TagMap{"p": []string{clientPublicKey.Hex()}},
|
Tags: nostr.TagMap{"p": []string{clientPublicKey.Hex()}},
|
||||||
Kinds: []nostr.Kind{nostr.KindNostrConnect},
|
Kinds: []nostr.Kind{nostr.KindNostrConnect},
|
||||||
Since: now,
|
Since: now,
|
||||||
@@ -142,6 +141,8 @@ func NewBunker(
|
|||||||
}, nostr.SubscriptionOptions{
|
}, nostr.SubscriptionOptions{
|
||||||
Label: "bunker46client",
|
Label: "bunker46client",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
go func() {
|
||||||
for ie := range events {
|
for ie := range events {
|
||||||
if ie.Kind != nostr.KindNostrConnect {
|
if ie.Kind != nostr.KindNostrConnect {
|
||||||
continue
|
continue
|
||||||
@@ -180,6 +181,8 @@ func NewBunker(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<-eosed
|
||||||
|
|
||||||
return bunker
|
return bunker
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user