code: func (s *stateSync) fillTasks(n int, req *stateReq) {
  	// Refill available tasks from the scheduler.
  	if len(s.tasks) < n {
  		new := s.sched.Missing(n - len(s.tasks))
  		for _, hash := range new {
  			s.tasks[hash] = &stateTask{make(map[string]struct{})}
  		}
  	}
  	// Find tasks that haven't been tried with the request's peer.
  	req.items = make([]common.Hash, 0, n)
  	req.tasks = make(map[common.Hash]*stateTask, n)
  	for hash, t := range s.tasks {
  		// Stop when we've gathered enough requests
  		if len(req.items) == n {
  			break
  		}
  		// Skip any requests we've already tried from this peer
  		if _, ok := t.attempts[req.peer.id]; ok {
  			continue
  		}
  		// Assign the request to this peer
  		t.attempts[req.peer.id] = struct{}{}
  		req.items = append(req.items, hash)
  		req.tasks[hash] = t
  		delete(s.tasks, hash)
  	}
  }
docs: // fillTasks fills the given request object with a maximum of n state download
  // tasks to send to the remote peer.