loopd: hide reservation manager behind flag.

pull/632/head
sputn1ck 4 months ago
parent 30acccbb6f
commit f00329d7c7
No known key found for this signature in database
GPG Key ID: 671103D881A5F0E4

@ -168,7 +168,7 @@ type Config struct {
TotalPaymentTimeout time.Duration `long:"totalpaymenttimeout" description:"The timeout to use for off-chain payments."`
MaxPaymentRetries int `long:"maxpaymentretries" description:"The maximum number of times an off-chain payment may be retried."`
EnableExperimental bool `long:"experimental" description:"Enable experimental features: taproot HTLCs and MuSig2 loop out sweeps."`
EnableExperimental bool `long:"experimental" description:"Enable experimental features: reservations"`
Lnd *lndConfig `group:"lnd" namespace:"lnd"`

@ -484,6 +484,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
}
// Create the reservation rpc server.
if d.cfg.EnableExperimental {
reservationStore := reservation.NewSQLStore(baseDb)
reservationConfig := &reservation.Config{
Store: reservationStore,
@ -496,6 +497,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
d.reservationManager = reservation.NewManager(
reservationConfig,
)
}
// Now finally fully initialize the swap client RPC server instance.
d.swapClientServer = swapClientServer{
@ -576,6 +578,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
}()
// Start the reservation manager.
if d.reservationManager != nil {
d.wg.Add(1)
go func() {
defer d.wg.Done()
@ -598,6 +601,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
d.internalErrChan <- err
}
}()
}
// Last, start our internal error handler. This will return exactly one
// error or nil on the main error channel to inform the caller that

@ -1145,6 +1145,10 @@ func (s *swapClientServer) ListReservations(ctx context.Context,
_ *clientrpc.ListReservationsRequest) (
*clientrpc.ListReservationsResponse, error) {
if s.reservationManager == nil {
return nil, status.Error(codes.Unimplemented,
"Restart loop with --experimental")
}
reservations, err := s.reservationManager.GetReservations(
ctx,
)

Loading…
Cancel
Save