Skip to content

Commit e8ddc78

Browse files
committed
loopd: add notification manager
This commit adds the notification manager to the loopd daemon.
1 parent bd3a82e commit e8ddc78

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

loopd/daemon.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/lightninglabs/loop/loopd/perms"
2222
"github.com/lightninglabs/loop/loopdb"
2323
loop_looprpc "github.com/lightninglabs/loop/looprpc"
24+
"github.com/lightninglabs/loop/notifications"
2425
loop_swaprpc "github.com/lightninglabs/loop/swapserverrpc"
2526
"github.com/lightninglabs/loop/sweepbatcher"
2627
"github.com/lightningnetwork/lnd/clock"
@@ -498,21 +499,35 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
498499
}
499500
}
500501

502+
// Start the notification manager.
503+
notificationCfg := &notifications.Config{
504+
Client: loop_swaprpc.NewSwapServerClient(swapClient.Conn),
505+
FetchL402: d.impl.Server.FetchL402,
506+
}
507+
notificationManager := notifications.NewManager(notificationCfg)
508+
509+
err = notificationManager.Run(d.mainCtx)
510+
if err != nil {
511+
return err
512+
}
513+
501514
var (
502515
reservationManager *reservation.Manager
503516
instantOutManager *instantout.Manager
504517
)
518+
505519
// Create the reservation and instantout managers.
506520
if d.cfg.EnableExperimental {
507521
reservationStore := reservation.NewSQLStore(
508522
loopdb.NewTypedStore[reservation.Querier](baseDb),
509523
)
510524
reservationConfig := &reservation.Config{
511-
Store: reservationStore,
512-
Wallet: d.lnd.WalletKit,
513-
ChainNotifier: d.lnd.ChainNotifier,
514-
ReservationClient: reservationClient,
515-
FetchL402: swapClient.Server.FetchL402,
525+
Store: reservationStore,
526+
Wallet: d.lnd.WalletKit,
527+
ChainNotifier: d.lnd.ChainNotifier,
528+
ReservationClient: reservationClient,
529+
FetchL402: swapClient.Server.FetchL402,
530+
NotificationManager: notificationManager,
516531
}
517532

518533
reservationManager = reservation.NewManager(

loopd/log.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/lightninglabs/loop/instantout/reservation"
1111
"github.com/lightninglabs/loop/liquidity"
1212
"github.com/lightninglabs/loop/loopdb"
13+
"github.com/lightninglabs/loop/notifications"
1314
"github.com/lightninglabs/loop/sweepbatcher"
1415
"github.com/lightningnetwork/lnd"
1516
"github.com/lightningnetwork/lnd/build"
@@ -48,6 +49,9 @@ func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) {
4849
lnd.AddSubLogger(
4950
root, instantout.Subsystem, intercept, instantout.UseLogger,
5051
)
52+
lnd.AddSubLogger(
53+
root, notifications.Subsystem, intercept, notifications.UseLogger,
54+
)
5155
}
5256

5357
// genSubLogger creates a logger for a subsystem. We provide an instance of

0 commit comments

Comments
 (0)