mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
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
This commit is contained in:
parent
ded8ab5975
commit
325441bf47
1 changed files with 15 additions and 0 deletions
|
|
@ -1490,6 +1490,11 @@ func (s *swapClientServer) InstantOut(ctx context.Context,
|
|||
req *looprpc.InstantOutRequest) (*looprpc.InstantOutResponse,
|
||||
error) {
|
||||
|
||||
if s.instantOutManager == nil {
|
||||
return nil, status.Error(codes.Unimplemented,
|
||||
"Restart loop with --experimental")
|
||||
}
|
||||
|
||||
reservationIds := make([]reservation.ID, len(req.ReservationIds))
|
||||
for i, id := range req.ReservationIds {
|
||||
if len(id) != reservation.IdLength {
|
||||
|
|
@ -1529,6 +1534,11 @@ func (s *swapClientServer) InstantOutQuote(ctx context.Context,
|
|||
req *looprpc.InstantOutQuoteRequest) (
|
||||
*looprpc.InstantOutQuoteResponse, error) {
|
||||
|
||||
if s.instantOutManager == nil {
|
||||
return nil, status.Error(codes.Unimplemented,
|
||||
"Restart loop with --experimental")
|
||||
}
|
||||
|
||||
quote, err := s.instantOutManager.GetInstantOutQuote(
|
||||
ctx, btcutil.Amount(req.Amt), req.ReservationIds,
|
||||
)
|
||||
|
|
@ -1548,6 +1558,11 @@ func (s *swapClientServer) ListInstantOuts(ctx context.Context,
|
|||
_ *looprpc.ListInstantOutsRequest) (
|
||||
*looprpc.ListInstantOutsResponse, error) {
|
||||
|
||||
if s.instantOutManager == nil {
|
||||
return nil, status.Error(codes.Unimplemented,
|
||||
"Restart loop with --experimental")
|
||||
}
|
||||
|
||||
instantOuts, err := s.instantOutManager.ListInstantOuts(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue