Skip to content

Commit

Permalink
add option to skip heights
Browse files Browse the repository at this point in the history
  • Loading branch information
tuky191 committed Aug 8, 2023
1 parent c6d1299 commit 0af2fa5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Config struct {
EnableExportModule bool
RichlistLength int
RichlistThreshold *sdk.Coin
SkipUpgradeHeights map[int64]bool
}

var singleton Config
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0af2fa5

Please sign in to comment.