func (pool *BlockPool) RemovePeer(peerID p2p.ID, err error) {
	peer := pool.peers[peerID]
	if peer == nil {
		return
	}
	pool.logger.Info("removing peer", "peerID", peerID, "error", err)

	// Reschedule the block requests made to the peer, or received and not processed yet.
	// Note that some of the requests may be removed further down.
	for h := range pool.peers[peerID].blocks {
		pool.rescheduleRequest(peerID, h)
	}

	oldMaxPeerHeight := pool.MaxPeerHeight
	// Delete the peer. This operation may result in the pool's MaxPeerHeight being lowered.
	pool.deletePeer(peer)

	// Check if the pool's MaxPeerHeight has been lowered.
	// This may happen if the tallest peer has been removed.
	if oldMaxPeerHeight > pool.MaxPeerHeight {
		// Remove any planned requests for heights over the new MaxPeerHeight.
		for h := range pool.plannedRequests {
			if h > pool.MaxPeerHeight {
				delete(pool.plannedRequests, h)
			}
		}
		// Adjust the nextRequestHeight to the new max plus one.
		if pool.nextRequestHeight > pool.MaxPeerHeight {
			pool.nextRequestHeight = pool.MaxPeerHeight + 1
		}
	}
}
// RemovePeer removes the blocks and requests from the peer, reschedules them and deletes the peer.
RemovePeer removes the blocks and requests from the peer, reschedules them and deletes the peer.
// RemovePeer removes the blocks and requests from the peer reschedules them and deletes the peer .
func (pool *BlockPool) RemovePeer(peerID p2p.ID, err error) {
	peer := pool.peers[peerID]
	if peer == nil {
		return
	}
	pool.logger.Info("removing peer", "peerID", peerID, "error", err)
	for h := range pool.peers[peerID].blocks {
		pool.rescheduleRequest(peerID, h)
	}
	oldMaxPeerHeight := pool.MaxPeerHeight
	pool.deletePeer(peer)
	if oldMaxPeerHeight > pool.MaxPeerHeight {
		for h := range pool.plannedRequests {
			if h > pool.MaxPeerHeight {
				delete(pool.plannedRequests, h)
			}
		}
		if pool.nextRequestHeight > pool.MaxPeerHeight {
			pool.nextRequestHeight = pool.MaxPeerHeight + 1
		}
	}
}
func ( pool * BlockPool ) RemovePeer ( peerID p2p . ID , err error ) { peer := pool . peers [ peerID ] if peer == nil { return } pool . logger . Info ( " " , " " , peerID , " " , err ) for h := range pool . peers [ peerID ] . blocks { pool . rescheduleRequest ( peerID , h ) } oldMaxPeerHeight := pool . MaxPeerHeight pool . deletePeer ( peer ) if oldMaxPeerHeight > pool . MaxPeerHeight { for h := range pool . plannedRequests { if h > pool . MaxPeerHeight { delete ( pool . plannedRequests , h ) } } if pool . nextRequestHeight > pool . MaxPeerHeight { pool . nextRequestHeight = pool . MaxPeerHeight + 1 } } }
RemovePeer removes the blocks and requests from the peer, reschedules them and deletes the peer.
RemovePeer removes the blocks and requests from the peer reschedules them and deletes the peer .
// Reschedule the block requests made to the peer, or received and not processed yet. // Note that some of the requests may be removed further down. // Delete the peer. This operation may result in the pool's MaxPeerHeight being lowered. // Check if the pool's MaxPeerHeight has been lowered. // This may happen if the tallest peer has been removed. // Remove any planned requests for heights over the new MaxPeerHeight. // Adjust the nextRequestHeight to the new max plus one.