diff --git a/backend/cmd/evm_node_indexer/main.go b/backend/cmd/evm_node_indexer/main.go index 4975bb3d0..f7d136e29 100644 --- a/backend/cmd/evm_node_indexer/main.go +++ b/backend/cmd/evm_node_indexer/main.go @@ -158,7 +158,6 @@ func Run() { // check config { - log.InfoWithFields(log.Fields{"config": *configPath, "version": version.Version, "commit": version.GitCommit, "chainName": utils.Config.Chain.ClConfig.ConfigName}, "starting") cfg := &types.Config{} err := utils.ReadConfig(cfg, *configPath) if err != nil { @@ -167,6 +166,7 @@ func Run() { log.Info("reading config completed") } utils.Config = cfg + log.InfoWithFields(log.Fields{"config": *configPath, "version": version.Version, "commit": version.GitCommit, "chainName": utils.Config.Chain.ClConfig.ConfigName}, "starting") if len(utils.Config.Eth1ErigonEndpoint) > 0 { eth1RpcEndpoint = utils.Config.Eth1ErigonEndpoint @@ -270,7 +270,7 @@ func Run() { if chainID != utils.Config.Chain.Id { // if the chain id is removed from the config, just remove this if, there is no point, except checking consistency log.Fatal(err, "node chain different from config chain", 0) // fatal, config doesn't match node } - log.Info("...check chain id done.") + log.InfoWithFields(log.Fields{"chainId": utils.Config.Chain.Id, "eth1RpcEndpoint": eth1RpcEndpoint, "bt.project": utils.Config.Bigtable.Project, "bt.instance": utils.Config.Bigtable.Instance}, "...check chain id done.") } // get latest block (as it's global, so we have a initial value) @@ -278,6 +278,18 @@ func Run() { updateBlockNumber(true, *noNewBlocks, time.Duration(*noNewBlocksThresholdSeconds)*time.Second, discordWebhookReportUrl, discordWebhookUser, discordWebhookAddTextFatal) log.Infof("...get latest block (%s) from node done.", _formatInt64(currentNodeBlockNumber.Load())) + go func() { + for { + latestPGBlock, err := psqlGetLatestBlock(false) + if err != nil { + log.Fatal(err, "error while using psqlGetLatestBlock (start / read)", 0) // fatal, as if there is no initial value, we have nothing to start from + } + + sendMessage(fmt.Sprintf("evmindexer for %s, version: %v, lastNodeBlock: %v, lastDbBlock: %v", getChainNamePretty(), version.Version, currentNodeBlockNumber.Load(), latestPGBlock), discordWebhookReportUrl, discordWebhookUser) + time.Sleep(time.Hour) + } + }() + // ////////////////////////////////////////// // Config done, now actually "doing" stuff // // //////////////////////////////////////////