code: func (s *stateSync) assignTasks() {
  	// Iterate over all idle peers and try to assign them state fetches
  	peers, _ := s.d.peers.NodeDataIdlePeers()
  	for _, p := range peers {
  		// Assign a batch of fetches proportional to the estimated latency/bandwidth
  		cap := p.NodeDataCapacity(s.d.requestRTT())
  		req := &stateReq{peer: p, timeout: s.d.requestTTL()}
  		s.fillTasks(cap, req)
  
  		// If the peer was assigned tasks to fetch, send the network request
  		if len(req.items) > 0 {
  			req.peer.log.Trace("Requesting new batch of data", "type", "state", "count", len(req.items))
  			select {
  			case s.d.trackStateReq <- req:
  				req.peer.FetchNodeData(req.items)
  			case <-s.cancel:
  			case <-s.d.cancelCh:
  			}
  		}
  	}
  }
docs: // assignTasks attempts to assign new tasks to all idle peers, either from the
  // batch currently being retried, or fetching new data from the trie sync itself.