Skip to content

Commit

Permalink
Merge pull request #312 from OffchainLabs/nil-header-check
Browse files Browse the repository at this point in the history
Fix requested block ahead of current block check
  • Loading branch information
PlasmaPower authored May 2, 2024
2 parents 39a2d17 + ce75c20 commit 01a3566
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arbitrum/apibackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 01a3566

Please sign in to comment.