Skip to content

Commit

Permalink
Merge pull request #189 from getAlby/fix/amt-validations
Browse files Browse the repository at this point in the history
Fix/amt-validations
  • Loading branch information
kiwiidb authored Jun 10, 2022
2 parents 5a35d7c + 22a788e commit 53275f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/addinvoice.ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func AddInvoice(c echo.Context, svc *service.LndhubService, userID int64) error
}

amount, err := svc.ParseInt(body.Amount)
if err != nil {
if err != nil || amount < 0 {
return c.JSON(http.StatusBadRequest, responses.BadArgumentsError)
}
c.Logger().Infof("Adding invoice: user_id:%v memo:%s value:%v description_hash:%s", userID, body.Memo, amount, body.DescriptionHash)
Expand Down
2 changes: 1 addition & 1 deletion controllers/keysend.ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewKeySendController(svc *service.LndhubService) *KeySendController {
}

type KeySendRequestBody struct {
Amount int64 `json:"amount" validate:"required"`
Amount int64 `json:"amount" validate:"required,gt=0"`
Destination string `json:"destination" validate:"required"`
Memo string `json:"memo" validate:"omitempty"`
CustomRecords map[string]string `json:"customRecords" validate:"omitempty"`
Expand Down

0 comments on commit 53275f2

Please sign in to comment.