diff --git a/eth/api_backend.go b/eth/api_backend.go index 57f5a50837..8ec19308f9 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -196,7 +196,9 @@ func (b *EthAPIBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash r if hash, ok := blockNrOrHash.Hash(); ok { header := b.eth.blockchain.GetHeaderByHash(hash) if header == nil { - return nil, errors.New("header for hash not found") + // Return 'null' and no error if block is not found. + // This behavior is required by RPC spec. + return nil, nil } if blockNrOrHash.RequireCanonical && b.eth.blockchain.GetCanonicalHash(header.Number.Uint64()) != hash { return nil, errors.New("hash is not currently canonical")