Skip to content

Commit baec55a

Browse files
committed
fix: guard against short reservation id when printing shortid
1 parent 91d1a3e commit baec55a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cmd/loop/instantout.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ func instantOut(ctx context.Context, cmd *cli.Command) error {
8888
fmt.Printf("Available reservations: \n\n")
8989
for _, res := range confirmedReservations {
9090
idx++
91+
if len(res.ReservationId) != reservation.IdLength {
92+
return fmt.Errorf("invalid reservation id length: "+
93+
"got %d, expected %d", len(res.ReservationId),
94+
reservation.IdLength)
95+
}
96+
9197
fmt.Printf("Reservation %v: shortid %x, amt %v, expiry "+
9298
"height %v \n", idx, res.ReservationId[:3], res.Amount,
9399
res.Expiry)

0 commit comments

Comments
 (0)