Skip to content

Commit

Permalink
use header rather than block to get latest number during init
Browse files Browse the repository at this point in the history
  • Loading branch information
christophercampbell committed Apr 10, 2024
1 parent 2002ac3 commit 76e1aa7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions synchronizer/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ func InitStartBlock(db db.DB, em etherman.Etherman, genesisBlock uint64, validiu
}

func findContractDeploymentBlock(ctx context.Context, em etherman.Etherman, contract common.Address) (*big.Int, error) {
latestBlock, err := em.BlockByNumber(ctx, nil)
latestHeader, err := em.HeaderByNumber(ctx, nil)
if err != nil {
return nil, err
}
firstBlock := findCode(ctx, em, contract, 0, latestBlock.Number().Int64())
firstBlock := findCode(ctx, em, contract, 0, latestHeader.Number.Int64())
return big.NewInt(firstBlock), nil
}

Expand Down

0 comments on commit 76e1aa7

Please sign in to comment.