From 5346b8ff28b406930d5954d022103fff142c624a Mon Sep 17 00:00:00 2001 From: Sina M <1591639+s1na@users.noreply.github.com> Date: Wed, 4 Jun 2025 16:07:16 +0200 Subject: [PATCH] eth/downloader: fix missing receipt (#31952) This fixes a regression introduced by #29158 where receipts of empty blocks were stored into the database as an empty byte array, instead of an RLP empty list. Fixes #31938 --------- Co-authored-by: Felix Lange --- eth/downloader/queue.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go index bd7acadfc4..9fe169d5f7 100644 --- a/eth/downloader/queue.go +++ b/eth/downloader/queue.go @@ -83,8 +83,13 @@ func newFetchResult(header *types.Header, snapSync bool) *fetchResult { } else if header.WithdrawalsHash != nil { item.Withdrawals = make(types.Withdrawals, 0) } - if snapSync && !header.EmptyReceipts() { - item.pending.Store(item.pending.Load() | (1 << receiptType)) + if snapSync { + if header.EmptyReceipts() { + // Ensure the receipts list is valid even if it isn't actively fetched. + item.Receipts = rlp.EmptyList + } else { + item.pending.Store(item.pending.Load() | (1 << receiptType)) + } } return item }