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