mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-19 14:54:22 +01:00
notifications: host notifications server
This commit is contained in:
@@ -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
|
||||
|
||||
5
main.go
5
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user