Skip to content

Commit

Permalink
use HeaderByHash for fewer queries
Browse files Browse the repository at this point in the history
  • Loading branch information
pirtleshell committed Oct 13, 2023
1 parent 20104e5 commit b5a799f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions decode/evm_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ func lookupBlockNumberFromHashParam(ctx context.Context, evmClient *ethclient.Cl
return 0, fmt.Errorf(fmt.Sprintf("error decoding block hash param from params %+v at index %d", params, paramIndex))
}

block, err := evmClient.BlockByHash(ctx, common.HexToHash(blockHash))
header, err := evmClient.HeaderByHash(ctx, common.HexToHash(blockHash))

if err != nil {
return 0, err
}

return block.Number().Int64(), nil
return header.Number.Int64(), nil
}

// Generic method to parse the block number from a set of params
Expand Down

0 comments on commit b5a799f

Please sign in to comment.