Skip to content

Commit

Permalink
Fixed prices validation
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Aug 18, 2023
1 parent 21a45d5 commit a477756
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,17 @@ func (c *NodeConfig) Validate() error {
if len(c.Moniker) > MaxMonikerLength {
return fmt.Errorf("moniker length cannot be greater than %d", MaxMonikerLength)
}
if c.GigabytePrices != "" {
if _, err := sdk.ParseCoinsNormalized(c.GigabytePrices); err != nil {
return errors.Wrap(err, "invalid gigabyte_prices")
}
if c.GigabytePrices == "" {
return fmt.Errorf("gigabyte_prices cannot be empty")
}
if c.HourlyPrices != "" {
if _, err := sdk.ParseCoinsNormalized(c.HourlyPrices); err != nil {
return errors.Wrap(err, "invalid hourly_prices")
}
if _, err := sdk.ParseCoinsNormalized(c.GigabytePrices); err != nil {
return errors.Wrap(err, "invalid gigabyte_prices")
}
if c.HourlyPrices == "" {
return fmt.Errorf("hourly_prices cannot be empty")
}
if _, err := sdk.ParseCoinsNormalized(c.HourlyPrices); err != nil {
return errors.Wrap(err, "invalid hourly_prices")
}
if c.RemoteURL == "" {
return errors.New("remote_url cannot be empty")
Expand Down

0 comments on commit a477756

Please sign in to comment.