graphql: handle missing block body in Raw resolver (#35027)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled

Return empty raw bytes when the GraphQL `Block.raw` resolver cannot load
the block body. This matches the nil handling used by the other
block-body-backed resolvers and avoids exposing RLP empty-list bytes as
raw block data.
This commit is contained in:
Richard Creighton 2026-05-22 06:59:02 +01:00 committed by GitHub
parent a059a357d1
commit d3edc58ef7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -929,7 +929,7 @@ func (b *Block) RawHeader(ctx context.Context) (hexutil.Bytes, error) {
func (b *Block) Raw(ctx context.Context) (hexutil.Bytes, error) { func (b *Block) Raw(ctx context.Context) (hexutil.Bytes, error) {
block, err := b.resolve(ctx) block, err := b.resolve(ctx)
if err != nil { if err != nil || block == nil {
return hexutil.Bytes{}, err return hexutil.Bytes{}, err
} }
return rlp.EncodeToBytes(block) return rlp.EncodeToBytes(block)