pub fn most_work_peers(&self) -> Vec<Arc<RwLock<Peer>>> {
		let peers = self.connected_peers();
		if peers.len() == 0 {
			return vec![];
		}

		let max_total_difficulty = peers
			.iter()
			.map(|x| {
				match x.try_read() {
					Ok(peer) => peer.info.total_difficulty.clone(),
					Err(_) => Difficulty::zero(),
				}
			})
			.max()
			.unwrap();

		let mut max_peers = peers
			.iter()
			.filter(|x| {
				match x.try_read() {
					Ok(peer) => {
						peer.info.total_difficulty == max_total_difficulty
					},
					Err(_) => false,
				}
			})
			.cloned()
			.collect::<Vec<_>>();

		thread_rng().shuffle(&mut max_peers);
		max_peers
	}
/// Return vec of all peers that currently have the most worked branch,
/// showing the highest total difficulty.
Return vec of all peers that currently have the most worked branch,
showing the highest total difficulty.
Return vec of all peers that currently have the most worked branch showing the highest total difficulty .
pub fn most_work_peers(&self) -> Vec<Arc<RwLock<Peer>>> {
		let peers = self.connected_peers();
		if peers.len() == 0 {
			return vec![];
		}
		let max_total_difficulty = peers
			.iter()
			.map(|x| {
				match x.try_read() {
					Ok(peer) => peer.info.total_difficulty.clone(),
					Err(_) => Difficulty::zero(),
				}
			})
			.max()
			.unwrap();
		let mut max_peers = peers
			.iter()
			.filter(|x| {
				match x.try_read() {
					Ok(peer) => {
						peer.info.total_difficulty == max_total_difficulty
					},
					Err(_) => false,
				}
			})
			.cloned()
			.collect::<Vec<_>>();
		thread_rng().shuffle(&mut max_peers);
		max_peers
	}
pub fn most_work_peers ( & self ) -> Vec < Arc < RwLock < Peer > > > { let peers = self . connected_peers ( ) ; if peers . len ( ) == 0 { return vec ! [ ] ; } let max_total_difficulty = peers . iter ( ) . map ( | x | { match x . try_read ( ) { Ok ( peer ) => peer . info . total_difficulty . clone ( ) , Err ( _ ) => Difficulty :: zero ( ) , } } ) . max ( ) . unwrap ( ) ; let mut max_peers = peers . iter ( ) . filter ( | x | { match x . try_read ( ) { Ok ( peer ) => { peer . info . total_difficulty == max_total_difficulty } , Err ( _ ) => false , } } ) . cloned ( ) . collect :: < Vec < _ > > ( ) ; thread_rng ( ) . shuffle ( & mut max_peers ) ; max_peers }
Return vec of all peers that currently have the most worked branch,
showing the highest total difficulty.
Return vec of all peers that currently have the most worked branch showing the highest total difficulty .
&self