From ba01123f54e5d8fe99b98d26fa78f8d5b3e0d433 Mon Sep 17 00:00:00 2001 From: prathamesh0 <42446521+prathamesh0@users.noreply.github.com> Date: Wed, 20 Jul 2022 09:34:44 +0530 Subject: [PATCH] Use geth's eth API on missing blocks for getHeaderByHash (#181) --- pkg/eth/api.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/eth/api.go b/pkg/eth/api.go index f98d1afd..eb9c7f20 100644 --- a/pkg/eth/api.go +++ b/pkg/eth/api.go @@ -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 } }