This commit is contained in:
Anatoly Yakovenko
2018-05-16 23:11:51 -07:00
parent 051fa6f1f1
commit b04716d40d

View File

@ -21,6 +21,7 @@ use rayon::prelude::*;
use result::{Error, Result};
use ring::rand::{SecureRandom, SystemRandom};
use signature::{PublicKey, Signature};
use std;
use std::collections::HashMap;
use std::io::Cursor;
use std::net::{SocketAddr, UdpSocket};
@ -28,7 +29,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, RwLock};
use std::thread::{sleep, spawn, JoinHandle};
use std::time::Duration;
use std;
/// Structure to be replicated by the network
#[derive(Serialize, Deserialize, Clone)]
@ -298,7 +298,9 @@ impl Crdt {
// max number of nodes that we could be converged to
pub fn convergence(&self) -> u64 {
let min = self.remote.values().fold(std::u64::MAX, |a,b| std::cmp::min(a, *b));
let min = self.remote
.values()
.fold(std::u64::MAX, |a, b| std::cmp::min(a, *b));
std::cmp::min(min, self.remote.values().len() as u64 + 1)
}