From ce75c202010f19b9f8c4f5d314df428fceab39d1 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Wed, 1 May 2024 11:18:52 -0500 Subject: [PATCH] Fix requested block ahead of current block check --- arbitrum/apibackend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrum/apibackend.go b/arbitrum/apibackend.go index 29615f8e26..bcdec8c208 100644 --- a/arbitrum/apibackend.go +++ b/arbitrum/apibackend.go @@ -535,7 +535,7 @@ func (a *APIBackend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOr hash, ishash := blockNrOrHash.Hash() bc := a.BlockChain() // check if we are not trying to get recent state that is not yet triedb referenced or committed in Blockchain.writeBlockWithState - if ishash && header.Number.Cmp(bc.CurrentBlock().Number) > 0 && bc.GetCanonicalHash(header.Number.Uint64()) != hash { + if ishash && header != nil && header.Number.Cmp(bc.CurrentBlock().Number) > 0 && bc.GetCanonicalHash(header.Number.Uint64()) != hash { return nil, nil, errors.New("requested block ahead of current block and the hash is not currently canonical") } return a.stateAndHeaderFromHeader(ctx, header, err)