mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-05 21:12:10 +02:00
nip46: client small tweaks.
This commit is contained in:
@ -109,10 +109,12 @@ func NewBunker(
|
|||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
now := nostr.Now()
|
||||||
events := pool.SubMany(ctx, relays, nostr.Filters{
|
events := pool.SubMany(ctx, relays, nostr.Filters{
|
||||||
{
|
{
|
||||||
Tags: nostr.TagMap{"p": []string{clientPublicKey}},
|
Tags: nostr.TagMap{"p": []string{clientPublicKey}},
|
||||||
Kinds: []int{nostr.KindNostrConnect},
|
Kinds: []int{nostr.KindNostrConnect},
|
||||||
|
Since: &now,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
for ie := range events {
|
for ie := range events {
|
||||||
@ -202,8 +204,8 @@ func (bunker *BunkerClient) RPC(ctx context.Context, method string, params []str
|
|||||||
|
|
||||||
respWaiter := make(chan Response)
|
respWaiter := make(chan Response)
|
||||||
bunker.listeners.Store(id, respWaiter)
|
bunker.listeners.Store(id, respWaiter)
|
||||||
|
|
||||||
hasWorked := false
|
hasWorked := false
|
||||||
|
|
||||||
for _, r := range bunker.relays {
|
for _, r := range bunker.relays {
|
||||||
relay, err := bunker.pool.EnsureRelay(r)
|
relay, err := bunker.pool.EnsureRelay(r)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -211,6 +213,7 @@ func (bunker *BunkerClient) RPC(ctx context.Context, method string, params []str
|
|||||||
}
|
}
|
||||||
relay.Publish(ctx, evt)
|
relay.Publish(ctx, evt)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !hasWorked {
|
if !hasWorked {
|
||||||
return "", fmt.Errorf("couldn't connect to any relay")
|
return "", fmt.Errorf("couldn't connect to any relay")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user