From baec55a3aa237f112431af71694635709ac8d3b9 Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Sun, 8 Mar 2026 16:36:17 +0300 Subject: [PATCH 1/2] fix: guard against short reservation id when printing shortid --- cmd/loop/instantout.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/loop/instantout.go b/cmd/loop/instantout.go index a78100b8c..59647c7b5 100644 --- a/cmd/loop/instantout.go +++ b/cmd/loop/instantout.go @@ -88,6 +88,12 @@ func instantOut(ctx context.Context, cmd *cli.Command) error { fmt.Printf("Available reservations: \n\n") for _, res := range confirmedReservations { idx++ + if len(res.ReservationId) != reservation.IdLength { + return fmt.Errorf("invalid reservation id length: "+ + "got %d, expected %d", len(res.ReservationId), + reservation.IdLength) + } + fmt.Printf("Reservation %v: shortid %x, amt %v, expiry "+ "height %v \n", idx, res.ReservationId[:3], res.Amount, res.Expiry) From ba224b50bf1076145fdf28c144fb9f9146aa4dc1 Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Mon, 20 Apr 2026 08:07:25 +0300 Subject: [PATCH 2/2] cmd/loop: fix panic on zero index in instantout reservation selection --- cmd/loop/instantout.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/loop/instantout.go b/cmd/loop/instantout.go index 59647c7b5..9783f0054 100644 --- a/cmd/loop/instantout.go +++ b/cmd/loop/instantout.go @@ -137,7 +137,7 @@ func instantOut(ctx context.Context, cmd *cli.Command) error { if err != nil { return err } - if idx < 0 { + if idx <= 0 { return fmt.Errorf("invalid index %v", idx) }