Skip to content

Commit 803534b

Browse files
committed
fix: guard against short reservation id when printing shortid
1 parent 3b54b19 commit 803534b

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
@@ -89,6 +89,12 @@ func instantOut(ctx context.Context, cmd *cli.Command) error {
8989
fmt.Printf("Available reservations: \n\n")
9090
for _, res := range confirmedReservations {
9191
idx++
92+
if len(res.ReservationId) != reservation.IdLength {
93+
return fmt.Errorf("invalid reservation id length: "+
94+
"got %d, expected %d", len(res.ReservationId),
95+
reservation.IdLength)
96+
}
97+
9298
fmt.Printf("Reservation %v: shortid %x, amt %v, expiry "+
9399
"height %v \n", idx, res.ReservationId[:3], res.Amount,
94100
res.Expiry)

0 commit comments

Comments
 (0)