pub fn compute_retransmit_peers<S: std::hash::BuildHasher>(
    stakes: Option<&HashMap<Pubkey, u64, S>>,
    cluster_info: &Arc<RwLock<ClusterInfo>>,
    fanout: usize,
) -> (Vec<ContactInfo>, Vec<ContactInfo>) {
    let (my_index, peers) = cluster_info.read().unwrap().sorted_peers_and_index(stakes);
    //calc num_layers and num_neighborhoods using the total number of nodes
    let (num_layers, layer_indices) = ClusterInfo::describe_data_plane(peers.len(), fanout);

    if num_layers <= 1 {
        /* single layer data plane */
        (peers, vec![])
    } else {
        //find my layer
        let locality = ClusterInfo::localize(&layer_indices, fanout, my_index);
        let upper_bound = cmp::min(locality.neighbor_bounds.1, peers.len());
        let neighbors = peers[locality.neighbor_bounds.0..upper_bound].to_vec();
        let mut children = Vec::new();
        for ix in locality.next_layer_peers {
            if let Some(peer) = peers.get(ix) {
                children.push(peer.clone());
                continue;
            }
            break;
        }
        (neighbors, children)
    }
}
/// Returns Neighbor Nodes and Children Nodes `(neighbors, children)` for a given node based on its stake (Bank Balance)
Returns Neighbor Nodes and Children Nodes `(neighbors, children)` for a given node based on its stake (Bank Balance)
Returns Neighbor Nodes and Children Nodes ` ( neighbors children ) ` for a given node based on its stake ( Bank Balance )
pub fn compute_retransmit_peers<S: std::hash::BuildHasher>(
    stakes: Option<&HashMap<Pubkey, u64, S>>,
    cluster_info: &Arc<RwLock<ClusterInfo>>,
    fanout: usize,
) -> (Vec<ContactInfo>, Vec<ContactInfo>) {
    let (my_index, peers) = cluster_info.read().unwrap().sorted_peers_and_index(stakes);
    //calc num_layers and num_neighborhoods using the total number of nodes
    let (num_layers, layer_indices) = ClusterInfo::describe_data_plane(peers.len(), fanout);
    if num_layers <= 1 {
        /* single layer data plane */
        (peers, vec![])
    } else {
        //find my layer
        let locality = ClusterInfo::localize(&layer_indices, fanout, my_index);
        let upper_bound = cmp::min(locality.neighbor_bounds.1, peers.len());
        let neighbors = peers[locality.neighbor_bounds.0..upper_bound].to_vec();
        let mut children = Vec::new();
        for ix in locality.next_layer_peers {
            if let Some(peer) = peers.get(ix) {
                children.push(peer.clone());
                continue;
            }
            break;
        }
        (neighbors, children)
    }
}
pub fn compute_retransmit_peers < S : std :: hash :: BuildHasher > ( stakes : Option < & HashMap < Pubkey , u64 , S > > , cluster_info : & Arc < RwLock < ClusterInfo > > , fanout : usize , ) -> ( Vec < ContactInfo > , Vec < ContactInfo > ) { let ( my_index , peers ) = cluster_info . read ( ) . unwrap ( ) . sorted_peers_and_index ( stakes ) ; //calc num_layers and num_neighborhoods using the total number of nodes let ( num_layers , layer_indices ) = ClusterInfo :: describe_data_plane ( peers . len ( ) , fanout ) ; if num_layers <= 1 { /* single layer data plane */ ( peers , vec ! [ ] ) } else { //find my layer let locality = ClusterInfo :: localize ( & layer_indices , fanout , my_index ) ; let upper_bound = cmp :: min ( locality . neighbor_bounds . 1 , peers . len ( ) ) ; let neighbors = peers [ locality . neighbor_bounds . 0 .. upper_bound ] . to_vec ( ) ; let mut children = Vec :: new ( ) ; for ix in locality . next_layer_peers { if let Some ( peer ) = peers . get ( ix ) { children . push ( peer . clone ( ) ) ; continue ; } break ; } ( neighbors , children ) } }
Returns Neighbor Nodes and Children Nodes `(neighbors, children)` for a given node based on its stake (Bank Balance)
Returns Neighbor Nodes and Children Nodes ` ( neighbors children ) ` for a given node based on its stake ( Bank Balance )
stakes
Option<&HashMap<Pubkey, u64, S>>
cluster_info
&Arc<RwLock<ClusterInfo>>
fanout
usize
stakes
Option<&HashMap<Pubkey, u64, S>>
cluster_info
&Arc<RwLock<ClusterInfo>>
fanout
usize