From 23dca0cd78febbaf35c23b0267341e1f8e31aa19 Mon Sep 17 00:00:00 2001 From: Newt6611 Date: Sun, 1 Mar 2026 22:19:57 +0800 Subject: [PATCH] graphql: handle nil block in Raw method Add a nil check for the resolved block to prevent a panic when encoding a nil block to RLP bytes. Co-Authored-By: Claude Opus 4.6 --- graphql/graphql.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql/graphql.go b/graphql/graphql.go index f25bfd127a..bda204437d 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -929,7 +929,7 @@ func (b *Block) RawHeader(ctx context.Context) (hexutil.Bytes, error) { func (b *Block) Raw(ctx context.Context) (hexutil.Bytes, error) { block, err := b.resolve(ctx) - if err != nil { + if err != nil || block == nil { return hexutil.Bytes{}, err } return rlp.EncodeToBytes(block)