eth/protocols/eth: put back original name of blockReceiptsToNetwork

I didn't like the new name and the comment was wrong.
This commit is contained in:
Felix Lange 2026-02-28 00:19:02 +01:00
parent 059f1f00f2
commit bf3ff6481b
4 changed files with 6 additions and 7 deletions

View file

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

View file

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

View file

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

View file

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