mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 13:44:31 +00:00
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:
parent
059f1f00f2
commit
bf3ff6481b
4 changed files with 6 additions and 7 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue