diff --git a/grpc_server.go b/grpc_server.go index 4c45bc9..d3055a5 100644 --- a/grpc_server.go +++ b/grpc_server.go @@ -13,6 +13,7 @@ import ( "github.com/breez/lspd/config" "github.com/breez/lspd/lightning" "github.com/breez/lspd/lnd" + "github.com/breez/lspd/notifications" lspdrpc "github.com/breez/lspd/rpc" "github.com/btcsuite/btcd/btcec/v2" "github.com/caddyserver/certmagic" @@ -32,6 +33,7 @@ type grpcServer struct { s *grpc.Server nodes map[string]*node c lspdrpc.ChannelOpenerServer + n notifications.NotificationsServer } type nodeContext struct { @@ -54,6 +56,7 @@ func NewGrpcServer( address string, certmagicDomain string, c lspdrpc.ChannelOpenerServer, + n notifications.NotificationsServer, ) (*grpcServer, error) { if len(configs) == 0 { return nil, fmt.Errorf("no nodes supplied") @@ -115,6 +118,7 @@ func NewGrpcServer( certmagicDomain: certmagicDomain, nodes: nodes, c: c, + n: n, }, nil } @@ -178,6 +182,7 @@ func (s *grpcServer) Start() error { }), ) lspdrpc.RegisterChannelOpenerServer(srv, s.c) + notifications.RegisterNotificationsServer(srv, s.n) s.s = srv s.lis = lis diff --git a/main.go b/main.go index 9c20127..b6075c1 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,7 @@ import ( "github.com/breez/lspd/interceptor" "github.com/breez/lspd/lnd" "github.com/breez/lspd/mempool" + "github.com/breez/lspd/notifications" "github.com/breez/lspd/postgresql" "github.com/btcsuite/btcd/btcec/v2" ) @@ -77,6 +78,7 @@ func main() { interceptStore := postgresql.NewPostgresInterceptStore(pool) forwardingStore := postgresql.NewForwardingEventStore(pool) + notificationsStore := postgresql.NewNotificationsStore(pool) var interceptors []interceptor.HtlcInterceptor for _, node := range nodes { @@ -118,7 +120,8 @@ func main() { address := os.Getenv("LISTEN_ADDRESS") certMagicDomain := os.Getenv("CERTMAGIC_DOMAIN") cs := NewChannelOpenerServer(interceptStore) - s, err := NewGrpcServer(nodes, address, certMagicDomain, cs) + ns := notifications.NewNotificationsServer(notificationsStore) + s, err := NewGrpcServer(nodes, address, certMagicDomain, cs, ns) if err != nil { log.Fatalf("failed to initialize grpc server: %v", err) }