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 <fjl@twurst.com>
This commit is contained in:
Sina M 2025-06-04 16:07:16 +02:00 committed by GitHub
parent 35c5b4fafd
commit 5346b8ff28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}