Skip to content

Commit 325441b

Browse files
committed
loopd: fix crash in instant if no --experimental
Previously the daemon crashed with a panic. Now the CLI returns the following message: [loop] rpc error: code = Unimplemented desc = Restart loop with --experimental
1 parent ded8ab5 commit 325441b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

loopd/swapclient_server.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,11 @@ func (s *swapClientServer) InstantOut(ctx context.Context,
14901490
req *looprpc.InstantOutRequest) (*looprpc.InstantOutResponse,
14911491
error) {
14921492

1493+
if s.instantOutManager == nil {
1494+
return nil, status.Error(codes.Unimplemented,
1495+
"Restart loop with --experimental")
1496+
}
1497+
14931498
reservationIds := make([]reservation.ID, len(req.ReservationIds))
14941499
for i, id := range req.ReservationIds {
14951500
if len(id) != reservation.IdLength {
@@ -1529,6 +1534,11 @@ func (s *swapClientServer) InstantOutQuote(ctx context.Context,
15291534
req *looprpc.InstantOutQuoteRequest) (
15301535
*looprpc.InstantOutQuoteResponse, error) {
15311536

1537+
if s.instantOutManager == nil {
1538+
return nil, status.Error(codes.Unimplemented,
1539+
"Restart loop with --experimental")
1540+
}
1541+
15321542
quote, err := s.instantOutManager.GetInstantOutQuote(
15331543
ctx, btcutil.Amount(req.Amt), req.ReservationIds,
15341544
)
@@ -1548,6 +1558,11 @@ func (s *swapClientServer) ListInstantOuts(ctx context.Context,
15481558
_ *looprpc.ListInstantOutsRequest) (
15491559
*looprpc.ListInstantOutsResponse, error) {
15501560

1561+
if s.instantOutManager == nil {
1562+
return nil, status.Error(codes.Unimplemented,
1563+
"Restart loop with --experimental")
1564+
}
1565+
15511566
instantOuts, err := s.instantOutManager.ListInstantOuts(ctx)
15521567
if err != nil {
15531568
return nil, err

0 commit comments

Comments
 (0)