Use geth's eth API on missing blocks for getHeaderByHash (#181)

This commit is contained in:
prathamesh0 2022-07-20 09:34:44 +05:30 committed by GitHub
parent b90c28906a
commit ba01123f54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}