Skip to content

Commit 1d6d598

Browse files
committed
separate config for committer from block
1 parent 15948f0 commit 1d6d598

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,17 @@ committer:
331331
blocksPerCommit: 1000
332332
```
333333

334+
#### Committer From Block
335+
From which block to start committing. Default is `0`.
336+
337+
cmd: `--committer-from-block`
338+
env: `COMMITTER_FROMBLOCK`
339+
yaml:
340+
```yaml
341+
committer:
342+
fromBlock: 20000000
343+
```
344+
334345
#### Reorg Handler
335346
Whether to enable the reorg handler. Default is `true`.
336347

cmd/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func init() {
5858
rootCmd.PersistentFlags().Bool("committer-enabled", true, "Toggle committer")
5959
rootCmd.PersistentFlags().Int("committer-blocks-per-commit", 10, "How many blocks to commit each interval")
6060
rootCmd.PersistentFlags().Int("committer-interval", 1000, "How often to commit blocks in milliseconds")
61+
rootCmd.PersistentFlags().Int("committer-from-block", 0, "From which block to start committing")
6162
rootCmd.PersistentFlags().Bool("reorgHandler-enabled", true, "Toggle reorg handler")
6263
rootCmd.PersistentFlags().Int("reorgHandler-interval", 1000, "How often to run reorg handler in milliseconds")
6364
rootCmd.PersistentFlags().Int("reorgHandler-blocks-per-scan", 100, "How many blocks to scan for reorgs")
@@ -109,6 +110,7 @@ func init() {
109110
viper.BindPFlag("committer.enabled", rootCmd.PersistentFlags().Lookup("committer-enabled"))
110111
viper.BindPFlag("committer.blocksPerCommit", rootCmd.PersistentFlags().Lookup("committer-blocks-per-commit"))
111112
viper.BindPFlag("committer.interval", rootCmd.PersistentFlags().Lookup("committer-interval"))
113+
viper.BindPFlag("committer.fromBlock", rootCmd.PersistentFlags().Lookup("committer-from-block"))
112114
viper.BindPFlag("reorgHandler.enabled", rootCmd.PersistentFlags().Lookup("reorgHandler-enabled"))
113115
viper.BindPFlag("reorgHandler.interval", rootCmd.PersistentFlags().Lookup("reorgHandler-interval"))
114116
viper.BindPFlag("reorgHandler.blocksPerScan", rootCmd.PersistentFlags().Lookup("reorgHandler-blocks-per-scan"))

configs/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type CommitterConfig struct {
2626
Enabled bool `mapstructure:"enabled"`
2727
Interval int `mapstructure:"interval"`
2828
BlocksPerCommit int `mapstructure:"blocksPerCommit"`
29+
FromBlock int `mapstructure:"fromBlock"`
2930
}
3031

3132
type ReorgHandlerConfig struct {

internal/orchestrator/committer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func NewCommitter(rpc rpc.IRPCClient, storage storage.IStorage) *Committer {
3939
triggerIntervalMs: triggerInterval,
4040
blocksPerCommit: blocksPerCommit,
4141
storage: storage,
42-
pollFromBlock: big.NewInt(int64(config.Cfg.Poller.FromBlock)),
42+
pollFromBlock: big.NewInt(int64(config.Cfg.Committer.FromBlock)),
4343
rpc: rpc,
4444
}
4545
}

0 commit comments

Comments
 (0)