mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Merge pull request #1090 from Olexandr88/master
fix: guard against short reservation id when printing shortid
This commit is contained in:
commit
807aa61ae6
1 changed files with 7 additions and 1 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue