Skip to content

Commit

Permalink
Fix session upsert message validation
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Feb 21, 2021
1 parent 9ad5c1a commit 419a78a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions x/session/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ func (m MsgUpsert) ValidateBasic() error {
return errors.Wrapf(ErrorInvalidField, "%s", "address")
}

// Duration shouldn't be zero
if m.Duration == 0 {
// Duration shouldn't be negative
if m.Duration < 0 {
return errors.Wrapf(ErrorInvalidField, "%s", "duration")
}

// Bandwidth shouldn't be zero
if m.Bandwidth.IsAllZero() {
// Bandwidth shouldn't be negative
if m.Bandwidth.IsAnyNegative() {
return errors.Wrapf(ErrorInvalidField, "%s", "bandwidth")
}

Expand Down

0 comments on commit 419a78a

Please sign in to comment.