mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
* feat: support multiple relays (WIP) * fix: multiple NWC url construction for multiple relays * fix: startup * chore: update go-nostr to fix pool relay reconnect * fix: split nip-47 queue info publish event for each relay url * fix: add relayUrls to dispatched nwc success events * fix: ensure newly created app info publishing is not blocked by sleep from failed publishes * feat: multiple relays improvements - update app deleted and updated consumers to handle multiple relays - handle multiple relays in healthcheck - display relay online status in about page - renaming and improved comments * chore: simplify error messages * fix: unnecessary db error log when checking if app has notification permission * fix: tests * chore: remove old comment * fix: app wallet subscription context usage
40 lines
916 B
Go
40 lines
916 B
Go
package tests
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/getAlby/hub/logger"
|
|
"github.com/nbd-wtf/go-nostr"
|
|
)
|
|
|
|
type mockSimplePool struct {
|
|
PublishedEvents []*nostr.Event
|
|
}
|
|
|
|
func NewMockSimplePool() *mockSimplePool {
|
|
return &mockSimplePool{}
|
|
}
|
|
|
|
func (relay *mockSimplePool) PublishMany(ctx context.Context, relayUrls []string, event nostr.Event) chan nostr.PublishResult {
|
|
logger.Logger.WithField("event", event).Info("Mock Publishing event")
|
|
relay.PublishedEvents = append(relay.PublishedEvents, &event)
|
|
|
|
channel := make(chan nostr.PublishResult)
|
|
go func() {
|
|
channel <- nostr.PublishResult{
|
|
RelayURL: "wss://fakerelay.com/v1",
|
|
}
|
|
close(channel)
|
|
}()
|
|
return channel
|
|
}
|
|
|
|
func (relay *mockSimplePool) QuerySingle(
|
|
ctx context.Context,
|
|
urls []string,
|
|
filter nostr.Filter,
|
|
opts ...nostr.SubscriptionOption,
|
|
) *nostr.RelayEvent {
|
|
logger.Logger.Error("Mock pool QuerySingle is not supported yet")
|
|
return nil
|
|
}
|