diff --git a/loopd/daemon.go b/loopd/daemon.go index 12e2c2192..8f4e6d081 100644 --- a/loopd/daemon.go +++ b/loopd/daemon.go @@ -21,6 +21,7 @@ import ( "github.com/lightninglabs/loop/loopd/perms" "github.com/lightninglabs/loop/loopdb" loop_looprpc "github.com/lightninglabs/loop/looprpc" + "github.com/lightninglabs/loop/notifications" loop_swaprpc "github.com/lightninglabs/loop/swapserverrpc" "github.com/lightninglabs/loop/sweepbatcher" "github.com/lightningnetwork/lnd/clock" @@ -498,21 +499,35 @@ func (d *Daemon) initialize(withMacaroonService bool) error { } } + // Start the notification manager. + notificationCfg := ¬ifications.Config{ + Client: loop_swaprpc.NewSwapServerClient(swapClient.Conn), + FetchL402: d.impl.Server.FetchL402, + } + notificationManager := notifications.NewManager(notificationCfg) + + err = notificationManager.Run(d.mainCtx) + if err != nil { + return err + } + var ( reservationManager *reservation.Manager instantOutManager *instantout.Manager ) + // Create the reservation and instantout managers. if d.cfg.EnableExperimental { reservationStore := reservation.NewSQLStore( loopdb.NewTypedStore[reservation.Querier](baseDb), ) reservationConfig := &reservation.Config{ - Store: reservationStore, - Wallet: d.lnd.WalletKit, - ChainNotifier: d.lnd.ChainNotifier, - ReservationClient: reservationClient, - FetchL402: swapClient.Server.FetchL402, + Store: reservationStore, + Wallet: d.lnd.WalletKit, + ChainNotifier: d.lnd.ChainNotifier, + ReservationClient: reservationClient, + FetchL402: swapClient.Server.FetchL402, + NotificationManager: notificationManager, } reservationManager = reservation.NewManager( diff --git a/loopd/log.go b/loopd/log.go index 970bd806b..a4f433f01 100644 --- a/loopd/log.go +++ b/loopd/log.go @@ -10,6 +10,7 @@ import ( "github.com/lightninglabs/loop/instantout/reservation" "github.com/lightninglabs/loop/liquidity" "github.com/lightninglabs/loop/loopdb" + "github.com/lightninglabs/loop/notifications" "github.com/lightninglabs/loop/sweepbatcher" "github.com/lightningnetwork/lnd" "github.com/lightningnetwork/lnd/build" @@ -48,6 +49,9 @@ func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) { lnd.AddSubLogger( root, instantout.Subsystem, intercept, instantout.UseLogger, ) + lnd.AddSubLogger( + root, notifications.Subsystem, intercept, notifications.UseLogger, + ) } // genSubLogger creates a logger for a subsystem. We provide an instance of