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 }