@@ -705,11 +705,9 @@ func (d *Downloader) fetchHead(p *peerConnection) (head *types.Header, pivot *ty
705
705
// calculateRequestSpan calculates what headers to request from a peer when trying to determine the
706
706
// common ancestor.
707
707
// It returns parameters to be used for peer.RequestHeadersByNumber:
708
- //
709
- // from - starting block number
710
- // count - number of headers to request
711
- // skip - number of headers to skip
712
- //
708
+ // from - starting block number
709
+ // count - number of headers to request
710
+ // skip - number of headers to skip
713
711
// and also returns 'max', the last block which is expected to be returned by the remote peers,
714
712
// given the (from,count,skip)
715
713
func calculateRequestSpan (remoteHeight , localHeight uint64 ) (int64 , int , int , uint64 ) {
@@ -1324,22 +1322,22 @@ func (d *Downloader) fetchReceipts(from uint64) error {
1324
1322
// various callbacks to handle the slight differences between processing them.
1325
1323
//
1326
1324
// The instrumentation parameters:
1327
- // - errCancel: error type to return if the fetch operation is cancelled (mostly makes logging nicer)
1328
- // - deliveryCh: channel from which to retrieve downloaded data packets (merged from all concurrent peers)
1329
- // - deliver: processing callback to deliver data packets into type specific download queues (usually within `queue`)
1330
- // - wakeCh: notification channel for waking the fetcher when new tasks are available (or sync completed)
1331
- // - expire: task callback method to abort requests that took too long and return the faulty peers (traffic shaping)
1332
- // - pending: task callback for the number of requests still needing download (detect completion/non-completability)
1333
- // - inFlight: task callback for the number of in-progress requests (wait for all active downloads to finish)
1334
- // - throttle: task callback to check if the processing queue is full and activate throttling (bound memory use)
1335
- // - reserve: task callback to reserve new download tasks to a particular peer (also signals partial completions)
1336
- // - fetchHook: tester callback to notify of new tasks being initiated (allows testing the scheduling logic)
1337
- // - fetch: network callback to actually send a particular download request to a physical remote peer
1338
- // - cancel: task callback to abort an in-flight download request and allow rescheduling it (in case of lost peer)
1339
- // - capacity: network callback to retrieve the estimated type-specific bandwidth capacity of a peer (traffic shaping)
1340
- // - idle: network callback to retrieve the currently (type specific) idle peers that can be assigned tasks
1341
- // - setIdle: network callback to set a peer back to idle and update its estimated capacity (traffic shaping)
1342
- // - kind: textual label of the type being downloaded to display in log messages
1325
+ // - errCancel: error type to return if the fetch operation is cancelled (mostly makes logging nicer)
1326
+ // - deliveryCh: channel from which to retrieve downloaded data packets (merged from all concurrent peers)
1327
+ // - deliver: processing callback to deliver data packets into type specific download queues (usually within `queue`)
1328
+ // - wakeCh: notification channel for waking the fetcher when new tasks are available (or sync completed)
1329
+ // - expire: task callback method to abort requests that took too long and return the faulty peers (traffic shaping)
1330
+ // - pending: task callback for the number of requests still needing download (detect completion/non-completability)
1331
+ // - inFlight: task callback for the number of in-progress requests (wait for all active downloads to finish)
1332
+ // - throttle: task callback to check if the processing queue is full and activate throttling (bound memory use)
1333
+ // - reserve: task callback to reserve new download tasks to a particular peer (also signals partial completions)
1334
+ // - fetchHook: tester callback to notify of new tasks being initiated (allows testing the scheduling logic)
1335
+ // - fetch: network callback to actually send a particular download request to a physical remote peer
1336
+ // - cancel: task callback to abort an in-flight download request and allow rescheduling it (in case of lost peer)
1337
+ // - capacity: network callback to retrieve the estimated type-specific bandwidth capacity of a peer (traffic shaping)
1338
+ // - idle: network callback to retrieve the currently (type specific) idle peers that can be assigned tasks
1339
+ // - setIdle: network callback to set a peer back to idle and update its estimated capacity (traffic shaping)
1340
+ // - kind: textual label of the type being downloaded to display in log messages
1343
1341
func (d * Downloader ) fetchParts (deliveryCh chan dataPack , deliver func (dataPack ) (int , error ), wakeCh chan bool ,
1344
1342
expire func () map [string ]int , pending func () int , inFlight func () bool , reserve func (* peerConnection , int ) (* fetchRequest , bool , bool ),
1345
1343
fetchHook func ([]* types.Header ), fetch func (* peerConnection , * fetchRequest ) error , cancel func (* fetchRequest ), capacity func (* peerConnection ) int ,
0 commit comments