Skip to content

Commit

Permalink
Use /hash endpoint instead of /header
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Sep 8, 2023
1 parent 73ce562 commit 4d4e952
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/indexer/indexer/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func (initializer Initializer) Init(ctx context.Context) error {
// check first block in node and in database, compare its hash.
// if hash is differed new periodic chain was started.
logger.Info().Str("network", initializer.network.String()).Msg("checking for new periodic chain...")
header, err := initializer.rpc.GetHeader(ctx, 1)
blockHash, err := initializer.rpc.BlockHash(ctx, 1)
if err != nil {
return err
}
firstBlock, err := initializer.block.Get(1)
if err == nil && firstBlock.Hash != header.Hash {
if err == nil && firstBlock.Hash != blockHash {
logger.Info().Str("network", initializer.network.String()).Msg("found new periodic chain")
logger.Warning().Str("network", initializer.network.String()).Msg("drop database...")
if err := initializer.repo.Drop(ctx); err != nil {
Expand Down

0 comments on commit 4d4e952

Please sign in to comment.