Rename ClusterInfo::new_with_keypair() to ClusterInfo::new()

This commit is contained in:
Michael Vines
2019-03-06 19:09:37 -08:00
parent bb93504965
commit a3cab470d3
11 changed files with 52 additions and 40 deletions

View File

@@ -17,13 +17,20 @@ use std::thread::sleep;
use std::time::Duration;
fn test_node(exit: &Arc<AtomicBool>) -> (Arc<RwLock<ClusterInfo>>, GossipService, UdpSocket) {
let keypair = Keypair::new();
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, None, tn.sockets.gossip, exit);
let _ = c.read().unwrap().my_data();
(c, d, tn.sockets.tvu.pop().unwrap())
let keypair = Arc::new(Keypair::new());
let mut test_node = Node::new_localhost_with_pubkey(keypair.pubkey());
let cluster_info = Arc::new(RwLock::new(ClusterInfo::new(
test_node.info.clone(),
keypair,
)));
let gossip_service =
GossipService::new(&cluster_info, None, None, test_node.sockets.gossip, exit);
let _ = cluster_info.read().unwrap().my_data();
(
cluster_info,
gossip_service,
test_node.sockets.tvu.pop().unwrap(),
)
}
/// Test that the network converges.

View File

@@ -109,7 +109,7 @@ fn test_replicator_startup_basic() {
);
}
let replicator_keypair = Keypair::new();
let replicator_keypair = Arc::new(Keypair::new());
info!("giving replicator lamports..");
@@ -238,7 +238,7 @@ fn test_replicator_startup_leader_hang() {
let (replicator_ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_block);
{
let replicator_keypair = Keypair::new();
let replicator_keypair = Arc::new(Keypair::new());
info!("starting replicator node");
let replicator_node = Node::new_localhost_with_pubkey(replicator_keypair.pubkey());
@@ -308,7 +308,7 @@ fn test_replicator_startup_ledger_hang() {
);
info!("starting replicator node");
let bad_keys = Keypair::new();
let bad_keys = Arc::new(Keypair::new());
let mut replicator_node = Node::new_localhost_with_pubkey(bad_keys.pubkey());
// Pass bad TVU sockets to prevent successful ledger download