graphql: handle missing block body in Raw resolver (#35027)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

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) {
block, err := b.resolve(ctx)
if err != nil {
if err != nil || block == nil {
return hexutil.Bytes{}, err
}
return rlp.EncodeToBytes(block)