Skip to content

Commit

Permalink
func (t *BlockTracker) Init() fix
Browse files Browse the repository at this point in the history
  • Loading branch information
igorcrevar committed Jun 12, 2023
1 parent cfdf09b commit b7fd5e5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions blocktracker/blocktracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,12 @@ func (t *BlockTracker) Init() (err error) {
break
}
block, err = t.provider.GetBlockByHash(block.ParentHash, false)
// if block does not exist (for example reorg happened) GetBlockByHash will return nil, nil
if err != nil || block == nil {
if err != nil {
return
} else if block == nil {
// if block does not exist (for example reorg happened) GetBlockByHash will return nil, nil
err = fmt.Errorf("block with hash %s not found", block.ParentHash)

return
}
}
Expand Down

0 comments on commit b7fd5e5

Please sign in to comment.