From a477756d52cba0be6aa07257d02927c57336008f Mon Sep 17 00:00:00 2001 From: Srinivas Baride Date: Fri, 18 Aug 2023 16:12:50 +0530 Subject: [PATCH] Fixed prices validation --- types/config.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/types/config.go b/types/config.go index fa3ed91..09e3ee5 100644 --- a/types/config.go +++ b/types/config.go @@ -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")