From 3bebd989ba1d098177c35c856d20d56363072b98 Mon Sep 17 00:00:00 2001 From: healthykim Date: Mon, 30 Mar 2026 18:29:58 +0900 Subject: [PATCH] handle the large first receipt case --- eth/protocols/eth/handlers.go | 3 +++ eth/protocols/eth/receipt.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/eth/protocols/eth/handlers.go b/eth/protocols/eth/handlers.go index 10bf20875e..09b0341f1a 100644 --- a/eth/protocols/eth/handlers.go +++ b/eth/protocols/eth/handlers.go @@ -328,6 +328,9 @@ func serviceGetReceiptsQuery70(chain *core.BlockChain, query GetReceiptsRequest, log.Error("Error in block receipts conversion", "hash", hash, "err", err) continue } + if results == nil { + break + } receipts.AppendRaw(results) bytes += len(results) if incomplete { diff --git a/eth/protocols/eth/receipt.go b/eth/protocols/eth/receipt.go index a113cd67af..84185bea4a 100644 --- a/eth/protocols/eth/receipt.go +++ b/eth/protocols/eth/receipt.go @@ -276,6 +276,10 @@ func blockReceiptsToNetwork(blockReceipts, blockBody rlp.RawValue, q receiptQuer // which is always true because EIP-2718 does not allow tx types > 0x7f. size := rlp.ListSize(1 + uint64(len(content))) if q.sizeLimit > 0 && (uint64(enc.Size())+size) > q.sizeLimit { + if uint(i) == uint(q.firstIndex) { + // The first receipt doesn't fit into the size limit. + return nil, false, nil + } incomplete = true break }