Merge pull request #1090 from Olexandr88/master

fix: guard against short reservation id when printing shortid
This commit is contained in:
Slyghtning 2026-04-29 16:33:28 +02:00 committed by GitHub
commit 807aa61ae6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
@ -131,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)
}