diff --git a/server/config/config.go b/server/config/config.go index f4ac30a30dd9..3145e773b5ce 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -3,6 +3,7 @@ package config import ( "fmt" "math" + "strings" "github.com/spf13/viper" @@ -269,7 +270,10 @@ func (c *Config) GetMinGasPrices() sdk.DecCoins { return sdk.DecCoins{} } - gasPrices, err := sdk.ParseDecCoins(c.MinGasPrices) + // replace `;` with `,` to support both `;` and `,` as separators in server config + minGasPrices := strings.ReplaceAll(c.MinGasPrices, ";", ",") + + gasPrices, err := sdk.ParseDecCoins(minGasPrices) if err != nil { panic(fmt.Sprintf("invalid minimum gas prices: %v", err)) } diff --git a/server/config/config_test.go b/server/config/config_test.go index d4562374f779..841ad3519ee9 100644 --- a/server/config/config_test.go +++ b/server/config/config_test.go @@ -4,6 +4,7 @@ import ( "bytes" "os" "path/filepath" + "strings" "testing" "github.com/spf13/viper" @@ -31,6 +32,15 @@ func TestGetAndSetMinimumGas(t *testing.T) { require.EqualValues(t, cfg.GetMinGasPrices(), input) } +func TestGetMinimumGasWithSemicolon(t *testing.T) { + cfg := DefaultConfig() + cfg.MinGasPrices = "0.001bar;5.00foo;0.01zoo" + + exp, err := sdk.ParseDecCoins(strings.ReplaceAll(cfg.MinGasPrices, ";", ",")) + require.NoError(t, err) + require.EqualValues(t, cfg.GetMinGasPrices(), exp) +} + func TestIndexEventsMarshalling(t *testing.T) { expectedIn := `index-events = ["key1", "key2", ]` + "\n" cfg := DefaultConfig()