mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 01:41:36 +00:00
eth/downloader: use nresults
This commit is contained in:
parent
a94f0a8ac8
commit
1c8dd7fe0e
1 changed files with 6 additions and 4 deletions
|
|
@ -562,9 +562,10 @@ func (q *queue) DeliverBodies(id string, hashes eth.BlockBodyHashes, bodies []et
|
||||||
q.lock.Lock()
|
q.lock.Lock()
|
||||||
defer q.lock.Unlock()
|
defer q.lock.Unlock()
|
||||||
|
|
||||||
txLists := make([][]*types.Transaction, len(bodies))
|
nresults := len(hashes.TransactionRoots)
|
||||||
uncleLists := make([][]*types.Header, len(bodies))
|
txLists := make([][]*types.Transaction, nresults)
|
||||||
withdrawalLists := make([][]*types.Withdrawal, len(bodies))
|
uncleLists := make([][]*types.Header, nresults)
|
||||||
|
withdrawalLists := make([][]*types.Withdrawal, nresults)
|
||||||
|
|
||||||
validate := func(index int, header *types.Header) error {
|
validate := func(index int, header *types.Header) error {
|
||||||
// Detect skipped response: the peer returned an empty body for a non-empty block
|
// Detect skipped response: the peer returned an empty body for a non-empty block
|
||||||
|
|
@ -618,8 +619,9 @@ func (q *queue) DeliverBodies(id string, hashes eth.BlockBodyHashes, bodies []et
|
||||||
result.Withdrawals = withdrawalLists[index]
|
result.Withdrawals = withdrawalLists[index]
|
||||||
result.SetBodyDone()
|
result.SetBodyDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
return q.deliver(id, q.blockTaskPool, q.blockTaskQueue, q.blockPendPool,
|
return q.deliver(id, q.blockTaskPool, q.blockTaskQueue, q.blockPendPool,
|
||||||
bodyReqTimer, bodyInMeter, bodyDropMeter, len(bodies), validate, reconstruct)
|
bodyReqTimer, bodyInMeter, bodyDropMeter, nresults, validate, reconstruct)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeliverReceipts injects a receipt retrieval response into the results queue.
|
// DeliverReceipts injects a receipt retrieval response into the results queue.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue