diff --git a/configs/config.go b/configs/config.go index 8147e80..99e1269 100644 --- a/configs/config.go +++ b/configs/config.go @@ -79,6 +79,7 @@ type Config struct { RedisPassword string `env:"REDIS_PASSWORD"` RedisDB int `env:"REDIS_DB" envDefault:"0"` ValidationMode string `env:"VALIDATION_MODE" envDefault:"minimal"` + EnableReorgValidation bool `env:"ENABLE_REORG_VALIDATION" envDefault:"true"` } var Cfg Config diff --git a/internal/committer/reorg.go b/internal/committer/reorg.go index f1ec73e..ae9e079 100644 --- a/internal/committer/reorg.go +++ b/internal/committer/reorg.go @@ -20,6 +20,9 @@ func RunReorgValidator() { if !config.Cfg.CommitterIsLive { return } + if !config.Cfg.EnableReorgValidation { + return + } lastBlockCheck := int64(0) for { diff --git a/internal/libs/clickhouse.go b/internal/libs/clickhouse.go index 63afd8f..699f0dc 100644 --- a/internal/libs/clickhouse.go +++ b/internal/libs/clickhouse.go @@ -167,7 +167,7 @@ func GetBlockHeadersForReorgCheck(chainId uint64, startBlockNumber uint64, endBl length := endBlockNumber - startBlockNumber + 1 blocksRaw := make([]*common.Block, length) - query := fmt.Sprintf("SELECT block_number, hash, parent_hash FROM %s.blocks FINAL WHERE chain_id = %d AND block_number BETWEEN %d AND %d order by block_number", + query := fmt.Sprintf("SELECT chain_id, block_number, hash, parent_hash FROM %s.blocks WHERE chain_id = %d AND block_number BETWEEN %d AND %d order by block_number", config.Cfg.CommitterClickhouseDatabase, chainId, startBlockNumber,