mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +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())
|
hashes = append(hashes, block.Hash())
|
||||||
receiptsRLP := backend.chain.GetReceiptsRLP(block.Hash())
|
receiptsRLP := backend.chain.GetReceiptsRLP(block.Hash())
|
||||||
bodyRLP := backend.chain.GetBodyRLP(block.Hash())
|
bodyRLP := backend.chain.GetBodyRLP(block.Hash())
|
||||||
tr, _ := encodeTypes(receiptsRLP, bodyRLP)
|
tr, _ := blockReceiptsToNetwork(receiptsRLP, bodyRLP)
|
||||||
receipts.AppendRaw(tr)
|
receipts.AppendRaw(tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ func ServiceGetReceiptsQuery(chain *core.BlockChain, query GetReceiptsRequest) r
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
results, err = encodeTypes(results, body)
|
results, err = blockReceiptsToNetwork(results, body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error in block receipts conversion", "hash", hash, "err", err)
|
log.Error("Error in block receipts conversion", "hash", hash, "err", err)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -162,10 +162,9 @@ func writeReceiptForHash(bloomBuf *[6]byte) func([]byte, *bytes.Buffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// encodeTypes takes a slice of rlp-encoded receipts, and transactions,
|
// blockReceiptsToNetwork takes a slice of rlp-encoded receipts, and transactions,
|
||||||
// and applies the type-encoding on the receipts (for non-legacy receipts).
|
// and re-encodes them for the network protocol.
|
||||||
// e.g. for non-legacy receipts: receipt-data -> {tx-type || receipt-data}
|
func blockReceiptsToNetwork(blockReceipts, blockBody rlp.RawValue) ([]byte, error) {
|
||||||
func encodeTypes(blockReceipts, blockBody rlp.RawValue) ([]byte, error) {
|
|
||||||
txTypesIter, err := txTypesInBody(blockBody)
|
txTypesIter, err := txTypesInBody(blockBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid block body: %v", err)
|
return nil, fmt.Errorf("invalid block body: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ func TestReceiptList(t *testing.T) {
|
||||||
canonBody, _ := rlp.EncodeToBytes(blockBody)
|
canonBody, _ := rlp.EncodeToBytes(blockBody)
|
||||||
|
|
||||||
// convert from storage encoding to network encoding
|
// convert from storage encoding to network encoding
|
||||||
network, err := encodeTypes(canonDB, canonBody)
|
network, err := blockReceiptsToNetwork(canonDB, canonBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("test[%d]: encodeTypes error: %v", i, err)
|
t.Fatalf("test[%d]: encodeTypes error: %v", i, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue