Skip to content

Commit

Permalink
Use geth's eth API on missing blocks for getHeaderByHash (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
prathamesh0 authored Jul 20, 2022
1 parent b90c289 commit ba01123
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@ func (pea *PublicEthAPI) GetHeaderByHash(ctx context.Context, hash common.Hash)
}

if pea.proxyOnError {
if header, err := pea.ethClient.HeaderByHash(ctx, hash); header != nil && err == nil {
var result map[string]interface{}
if err := pea.rpc.CallContext(ctx, &result, "eth_getHeaderByHash", hash); result != nil && err == nil {
go pea.writeStateDiffFor(hash)
if res, err := pea.rpcMarshalHeader(header); err != nil {
return res
}
return result
}
}

Expand Down

0 comments on commit ba01123

Please sign in to comment.