Add a service to fill indexing gap for watched addresses
This commit is contained in:
@@ -53,6 +53,9 @@ const (
|
||||
|
||||
VALIDATOR_ENABLED = "VALIDATOR_ENABLED"
|
||||
VALIDATOR_EVERY_NTH_BLOCK = "VALIDATOR_EVERY_NTH_BLOCK"
|
||||
|
||||
GAP_FILLER_ENABLED = "GAP_FILLER_ENABLED"
|
||||
GAP_FILLER_INTERVAL = "GAP_FILLER_INTERVAL"
|
||||
)
|
||||
|
||||
// Config struct
|
||||
@@ -93,6 +96,9 @@ type Config struct {
|
||||
|
||||
StateValidationEnabled bool
|
||||
StateValidationEveryNthBlock uint64
|
||||
|
||||
WatchedAddressGapFillerEnabled bool
|
||||
WatchedAddressGapFillInterval int
|
||||
}
|
||||
|
||||
// NewConfig is used to initialize a watcher config from a .toml file
|
||||
@@ -228,6 +234,8 @@ func NewConfig() (*Config, error) {
|
||||
|
||||
c.loadValidatorConfig()
|
||||
|
||||
c.loadGapFillerConfig()
|
||||
|
||||
return c, err
|
||||
}
|
||||
|
||||
@@ -290,3 +298,11 @@ func (c *Config) loadValidatorConfig() {
|
||||
c.StateValidationEnabled = viper.GetBool("validator.enabled")
|
||||
c.StateValidationEveryNthBlock = viper.GetUint64("validator.everyNthBlock")
|
||||
}
|
||||
|
||||
func (c *Config) loadGapFillerConfig() {
|
||||
viper.BindEnv("gapfiller.enabled", GAP_FILLER_ENABLED)
|
||||
viper.BindEnv("gapfiller.interval", GAP_FILLER_INTERVAL)
|
||||
|
||||
c.WatchedAddressGapFillerEnabled = viper.GetBool("gapfiller.enabled")
|
||||
c.WatchedAddressGapFillInterval = viper.GetInt("gapfiller.interval")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user