func (pool *BlockPool) makeRequestBatch(maxNumRequests int) []int {
	pool.removeBadPeers()
	// At this point pool.requests may include heights for requests to be redone due to removal of peers:
	// - peers timed out or were removed by switch
	// - FSM timed out on waiting to advance the block execution due to missing blocks at h or h+1
	// Determine the number of requests needed by subtracting the number of requests already made from the maximum
	// allowed
	numNeeded := maxNumRequests - len(pool.blocks)
	for len(pool.plannedRequests) < numNeeded {
		if pool.nextRequestHeight > pool.MaxPeerHeight {
			break
		}
		pool.plannedRequests[pool.nextRequestHeight] = struct{}{}
		pool.nextRequestHeight++
	}

	heights := make([]int, 0, len(pool.plannedRequests))
	for k := range pool.plannedRequests {
		heights = append(heights, int(k))
	}
	sort.Ints(heights)
	return heights
}
// Makes a batch of requests sorted by height such that the block pool has up to maxNumRequests entries.
Makes a batch of requests sorted by height such that the block pool has up to maxNumRequests entries.
// Makes a batch of requests sorted by height such that the block pool has up to maxNumRequests entries .
func (pool *BlockPool) makeRequestBatch(maxNumRequests int) []int {
	pool.removeBadPeers()
	numNeeded := maxNumRequests - len(pool.blocks)
	for len(pool.plannedRequests) < numNeeded {
		if pool.nextRequestHeight > pool.MaxPeerHeight {
			break
		}
		pool.plannedRequests[pool.nextRequestHeight] = struct{}{}
		pool.nextRequestHeight++
	}
	heights := make([]int, 0, len(pool.plannedRequests))
	for k := range pool.plannedRequests {
		heights = append(heights, int(k))
	}
	sort.Ints(heights)
	return heights
}
func ( pool * BlockPool ) makeRequestBatch ( maxNumRequests int ) [ ] int { pool . removeBadPeers ( ) numNeeded := maxNumRequests - len ( pool . blocks ) for len ( pool . plannedRequests ) < numNeeded { if pool . nextRequestHeight > pool . MaxPeerHeight { break } pool . plannedRequests [ pool . nextRequestHeight ] = struct { } { } pool . nextRequestHeight ++ } heights := make ( [ ] int , 0 , len ( pool . plannedRequests ) ) for k := range pool . plannedRequests { heights = append ( heights , int ( k ) ) } sort . Ints ( heights ) return heights }
Makes a batch of requests sorted by height such that the block pool has up to maxNumRequests entries.
Makes a batch of requests sorted by height such that the block pool has up to maxNumRequests entries .
// At this point pool.requests may include heights for requests to be redone due to removal of peers: // - peers timed out or were removed by switch // - FSM timed out on waiting to advance the block execution due to missing blocks at h or h+1 // Determine the number of requests needed by subtracting the number of requests already made from the maximum // allowed