From bf3ff6481bf44e962531527c412351b1d7df129c Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 28 Feb 2026 00:19:02 +0100 Subject: [PATCH] eth/protocols/eth: put back original name of blockReceiptsToNetwork I didn't like the new name and the comment was wrong. --- eth/protocols/eth/handler_test.go | 2 +- eth/protocols/eth/handlers.go | 2 +- eth/protocols/eth/receipt.go | 7 +++---- eth/protocols/eth/receipt_test.go | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/eth/protocols/eth/handler_test.go b/eth/protocols/eth/handler_test.go index 9fb9e77a2f..a1dcfc8147 100644 --- a/eth/protocols/eth/handler_test.go +++ b/eth/protocols/eth/handler_test.go @@ -593,7 +593,7 @@ func testGetBlockReceipts(t *testing.T, protocol uint) { hashes = append(hashes, block.Hash()) receiptsRLP := backend.chain.GetReceiptsRLP(block.Hash()) bodyRLP := backend.chain.GetBodyRLP(block.Hash()) - tr, _ := encodeTypes(receiptsRLP, bodyRLP) + tr, _ := blockReceiptsToNetwork(receiptsRLP, bodyRLP) receipts.AppendRaw(tr) } diff --git a/eth/protocols/eth/handlers.go b/eth/protocols/eth/handlers.go index 2f7eafb31f..90717472f9 100644 --- a/eth/protocols/eth/handlers.go +++ b/eth/protocols/eth/handlers.go @@ -282,7 +282,7 @@ func ServiceGetReceiptsQuery(chain *core.BlockChain, query GetReceiptsRequest) r continue } var err error - results, err = encodeTypes(results, body) + results, err = blockReceiptsToNetwork(results, body) if err != nil { log.Error("Error in block receipts conversion", "hash", hash, "err", err) continue diff --git a/eth/protocols/eth/receipt.go b/eth/protocols/eth/receipt.go index 580cbc7b59..a6062ce79d 100644 --- a/eth/protocols/eth/receipt.go +++ b/eth/protocols/eth/receipt.go @@ -162,10 +162,9 @@ func writeReceiptForHash(bloomBuf *[6]byte) func([]byte, *bytes.Buffer) { } } -// encodeTypes takes a slice of rlp-encoded receipts, and transactions, -// and applies the type-encoding on the receipts (for non-legacy receipts). -// e.g. for non-legacy receipts: receipt-data -> {tx-type || receipt-data} -func encodeTypes(blockReceipts, blockBody rlp.RawValue) ([]byte, error) { +// blockReceiptsToNetwork takes a slice of rlp-encoded receipts, and transactions, +// and re-encodes them for the network protocol. +func blockReceiptsToNetwork(blockReceipts, blockBody rlp.RawValue) ([]byte, error) { txTypesIter, err := txTypesInBody(blockBody) if err != nil { return nil, fmt.Errorf("invalid block body: %v", err) diff --git a/eth/protocols/eth/receipt_test.go b/eth/protocols/eth/receipt_test.go index c7be70eed3..05db2c1c68 100644 --- a/eth/protocols/eth/receipt_test.go +++ b/eth/protocols/eth/receipt_test.go @@ -105,7 +105,7 @@ func TestReceiptList(t *testing.T) { canonBody, _ := rlp.EncodeToBytes(blockBody) // convert from storage encoding to network encoding - network, err := encodeTypes(canonDB, canonBody) + network, err := blockReceiptsToNetwork(canonDB, canonBody) if err != nil { t.Fatalf("test[%d]: encodeTypes error: %v", i, err) }