Skip to content

Commit 0be1fe8

Browse files
committed
eth/downloader: remove requests
1 parent ff99699 commit 0be1fe8

File tree

4 files changed

+8
-22
lines changed

4 files changed

+8
-22
lines changed

eth/downloader/fetchers_concurrent_bodies.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ func (q *bodyQueue) request(peer *peerConnection, req *fetchRequest, resCh chan
8888
// deliver is responsible for taking a generic response packet from the concurrent
8989
// fetcher, unpacking the body data and delivering it to the downloader's queue.
9090
func (q *bodyQueue) deliver(peer *peerConnection, packet *eth.Response) (int, error) {
91-
txs, uncles, withdrawals, requests := packet.Res.(*eth.BlockBodiesResponse).Unpack()
92-
hashsets := packet.Meta.([][]common.Hash) // {txs hashes, uncle hashes, withdrawal hashes, requests hashes}
91+
txs, uncles, withdrawals := packet.Res.(*eth.BlockBodiesResponse).Unpack()
92+
hashsets := packet.Meta.([][]common.Hash) // {txs hashes, uncle hashes, withdrawal hashes}
9393

94-
accepted, err := q.queue.DeliverBodies(peer.id, txs, hashsets[0], uncles, hashsets[1], withdrawals, hashsets[2], requests, hashsets[3])
94+
accepted, err := q.queue.DeliverBodies(peer.id, txs, hashsets[0], uncles, hashsets[1], withdrawals, hashsets[2])
9595
switch {
9696
case err == nil && len(txs) == 0:
9797
peer.log.Trace("Requested bodies delivered")

eth/downloader/queue.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ func (q *queue) DeliverHeaders(id string, headers []*types.Header, hashes []comm
785785
func (q *queue) DeliverBodies(id string, txLists [][]*types.Transaction, txListHashes []common.Hash,
786786
uncleLists [][]*types.Header, uncleListHashes []common.Hash,
787787
withdrawalLists [][]*types.Withdrawal, withdrawalListHashes []common.Hash,
788-
requestsLists [][][]byte, requestsListHashes []common.Hash) (int, error) {
788+
) (int, error) {
789789
q.lock.Lock()
790790
defer q.lock.Unlock()
791791

@@ -809,19 +809,6 @@ func (q *queue) DeliverBodies(id string, txLists [][]*types.Transaction, txListH
809809
return errInvalidBody
810810
}
811811
}
812-
if header.RequestsHash == nil {
813-
// nil hash means that requests should not be present in body
814-
if requestsLists[index] != nil {
815-
return errInvalidBody
816-
}
817-
} else { // non-nil hash: body must have requests
818-
if requestsLists[index] == nil {
819-
return errInvalidBody
820-
}
821-
if requestsListHashes[index] != *header.RequestsHash {
822-
return errInvalidBody
823-
}
824-
}
825812
// Blocks must have a number of blobs corresponding to the header gas usage,
826813
// and zero before the Cancun hardfork.
827814
var blobs int

eth/downloader/queue_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func XTestDelivery(t *testing.T) {
341341
uncleHashes[i] = types.CalcUncleHash(uncles)
342342
}
343343
time.Sleep(100 * time.Millisecond)
344-
_, err := q.DeliverBodies(peer.id, txset, txsHashes, uncleset, uncleHashes, nil, nil, nil, nil)
344+
_, err := q.DeliverBodies(peer.id, txset, txsHashes, uncleset, uncleHashes, nil, nil)
345345
if err != nil {
346346
fmt.Printf("delivered %d bodies %v\n", len(txset), err)
347347
}

eth/protocols/eth/protocol.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,16 @@ type BlockBody struct {
229229

230230
// Unpack retrieves the transactions and uncles from the range packet and returns
231231
// them in a split flat format that's more consistent with the internal data structures.
232-
func (p *BlockBodiesResponse) Unpack() ([][]*types.Transaction, [][]*types.Header, [][]*types.Withdrawal, [][][]byte) {
232+
func (p *BlockBodiesResponse) Unpack() ([][]*types.Transaction, [][]*types.Header, [][]*types.Withdrawal) {
233233
var (
234234
txset = make([][]*types.Transaction, len(*p))
235235
uncleset = make([][]*types.Header, len(*p))
236236
withdrawalset = make([][]*types.Withdrawal, len(*p))
237-
requestset = make([][][]byte, len(*p))
238237
)
239238
for i, body := range *p {
240-
txset[i], uncleset[i], withdrawalset[i], requestset[i] = body.Transactions, body.Uncles, body.Withdrawals, body.Requests
239+
txset[i], uncleset[i], withdrawalset[i] = body.Transactions, body.Uncles, body.Withdrawals
241240
}
242-
return txset, uncleset, withdrawalset, requestset
241+
return txset, uncleset, withdrawalset
243242
}
244243

245244
// GetReceiptsRequest represents a block receipts query.

0 commit comments

Comments
 (0)