diff --git a/config/config.go b/config/config.go index a67aa25..c72849e 100644 --- a/config/config.go +++ b/config/config.go @@ -26,6 +26,7 @@ type Config struct { EnableExportModule bool RichlistLength int RichlistThreshold *sdk.Coin + SkipUpgradeHeights map[int64]bool } var singleton Config @@ -115,6 +116,20 @@ func newConfig() Config { } return &thresholdCoin }(), + SkipUpgradeHeights: func() map[int64]bool { + skipUpgradeHeightsStr := getValidEnv("SKIP_UPGRADE_HEIGHTS") + heightsMap := make(map[int64]bool) + + heights := strings.Split(skipUpgradeHeightsStr, ",") + for _, h := range heights { + height, err := strconv.ParseInt(h, 10, 64) + if err != nil { + panic(fmt.Errorf("invalid height in SKIP_UPGRADE_HEIGHTS: %s", h)) + } + heightsMap[height] = true + } + return heightsMap + }(), } viper.SetConfigType("toml") diff --git a/sync.go b/sync.go index b4afe39..4ef243c 100644 --- a/sync.go +++ b/sync.go @@ -92,7 +92,7 @@ func main() { batched, nil, true, // need this so KVStores are set - make(map[int64]bool), + mantlemintConfig.SkipUpgradeHeights, mantlemintConfig.Home, 0, codec,