code: func (q *queue) ReserveHeaders(p *peerConnection, count int) *fetchRequest {
  	q.lock.Lock()
  	defer q.lock.Unlock()
  
  	// Short circuit if the peer's already downloading something (sanity check to
  	// not corrupt state)
  	if _, ok := q.headerPendPool[p.id]; ok {
  		return nil
  	}
  	// Retrieve a batch of hashes, skipping previously failed ones
  	send, skip := uint64(0), []uint64{}
  	for send == 0 && !q.headerTaskQueue.Empty() {
  		from, _ := q.headerTaskQueue.Pop()
  		if q.headerPeerMiss[p.id] != nil {
  			if _, ok := q.headerPeerMiss[p.id][from.(uint64)]; ok {
  				skip = append(skip, from.(uint64))
  				continue
  			}
  		}
  		send = from.(uint64)
  	}
  	// Merge all the skipped batches back
  	for _, from := range skip {
  		q.headerTaskQueue.Push(from, -int64(from))
  	}
  	// Assemble and return the block download request
  	if send == 0 {
  		return nil
  	}
  	request := &fetchRequest{
  		Peer: p,
  		From: send,
  		Time: time.Now(),
  	}
  	q.headerPendPool[p.id] = request
  	return request
  }
docs: // ReserveHeaders reserves a set of headers for the given peer, skipping any
  // previously failed batches.