nip46: bunker client should wait for the initial EOSE before sending any requests.
This commit is contained in:
+11
-8
@@ -133,15 +133,16 @@ func NewBunker(
|
|||||||
cancellableCtx, cancel := context.WithCancel(ctx)
|
cancellableCtx, cancel := context.WithCancel(ctx)
|
||||||
_ = cancel
|
_ = 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() {
|
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 {
|
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