Make gossip selection stake based (#2848)

This commit is contained in:
Sagar Dhawan
2019-02-20 17:08:56 -08:00
committed by GitHub
parent 33c7f92f56
commit a484c87354
12 changed files with 211 additions and 71 deletions

View File

@@ -112,7 +112,7 @@ fn network_simulator(network: &mut Network) {
// make sure there is someone in the active set
let network_values: Vec<Node> = network.values().cloned().collect();
network_values.par_iter().for_each(|node| {
node.lock().unwrap().refresh_push_active_set();
node.lock().unwrap().refresh_push_active_set(None);
});
let mut total_bytes = bytes_tx;
for second in 1..num {
@@ -211,7 +211,7 @@ fn network_run_push(network: &mut Network, start: usize, end: usize) -> (usize,
}
if now % CRDS_GOSSIP_PUSH_MSG_TIMEOUT_MS == 0 && now > 0 {
network_values.par_iter().for_each(|node| {
node.lock().unwrap().refresh_push_active_set();
node.lock().unwrap().refresh_push_active_set(None);
});
}
total = network_values
@@ -249,7 +249,7 @@ fn network_run_pull(
let requests: Vec<_> = {
network_values
.par_iter()
.filter_map(|from| from.lock().unwrap().new_pull_request(now).ok())
.filter_map(|from| from.lock().unwrap().new_pull_request(now, None).ok())
.collect()
};
let transfered: Vec<_> = requests
@@ -372,7 +372,7 @@ fn test_prune_errors() {
.crds
.insert(CrdsValue::ContactInfo(ci.clone()), 0)
.unwrap();
crds_gossip.refresh_push_active_set();
crds_gossip.refresh_push_active_set(None);
let now = timestamp();
//incorrect dest
let mut res = crds_gossip.process_prune_msg(

View File

@@ -21,7 +21,7 @@ fn test_node(exit: Arc<AtomicBool>) -> (Arc<RwLock<ClusterInfo>>, GossipService,
let mut tn = Node::new_localhost_with_pubkey(keypair.pubkey());
let cluster_info = ClusterInfo::new_with_keypair(tn.info.clone(), Arc::new(keypair));
let c = Arc::new(RwLock::new(cluster_info));
let d = GossipService::new(&c.clone(), None, tn.sockets.gossip, exit);
let d = GossipService::new(&c.clone(), None, None, tn.sockets.gossip, exit);
let _ = c.read().unwrap().my_data();
(c, d, tn.sockets.tvu.pop().unwrap())
}

View File

@@ -32,7 +32,7 @@ fn new_gossip(
gossip: UdpSocket,
exit: Arc<AtomicBool>,
) -> GossipService {
GossipService::new(&cluster_info, None, gossip, exit)
GossipService::new(&cluster_info, None, None, gossip, exit)
}
/// Test that message sent from leader to target1 and replayed to target2