diff --git a/src/bin/bench-tps.rs b/src/bin/bench-tps.rs index 473fe9dddf..30cec91088 100644 --- a/src/bin/bench-tps.rs +++ b/src/bin/bench-tps.rs @@ -671,7 +671,7 @@ fn converge( None, gossip_socket, exit_signal.clone(), - ).expect("DataReplicator::new"); + ); let mut v: Vec = vec![]; //wait for the network to converge, 30 seconds should be plenty for _ in 0..30 { diff --git a/src/blob_fetch_stage.rs b/src/blob_fetch_stage.rs index 2800bfd2af..0625c8e02f 100644 --- a/src/blob_fetch_stage.rs +++ b/src/blob_fetch_stage.rs @@ -32,7 +32,6 @@ impl BlobFetchStage { .into_iter() .map(|socket| { streamer::blob_receiver(socket, exit.clone(), recycler.clone(), sender.clone()) - .expect("blob receiver init") }) .collect(); diff --git a/src/fullnode.rs b/src/fullnode.rs index f92662da4c..7c4929da4d 100644 --- a/src/fullnode.rs +++ b/src/fullnode.rs @@ -211,7 +211,7 @@ impl Fullnode { ledger_path, node.sockets.gossip, exit.clone(), - ).expect("Ncp::new"); + ); thread_hdls.extend(ncp.thread_hdls()); match leader_info { diff --git a/src/ncp.rs b/src/ncp.rs index bef2191487..11f3468848 100644 --- a/src/ncp.rs +++ b/src/ncp.rs @@ -2,7 +2,6 @@ use crdt::Crdt; use packet::BlobRecycler; -use result::Result; use service::Service; use std::net::UdpSocket; use std::sync::atomic::{AtomicBool, Ordering}; @@ -24,7 +23,7 @@ impl Ncp { ledger_path: Option<&str>, gossip_socket: UdpSocket, exit: Arc, - ) -> Result { + ) -> Self { let blob_recycler = BlobRecycler::default(); let (request_sender, request_receiver) = channel(); let gossip_socket = Arc::new(gossip_socket); @@ -38,7 +37,7 @@ impl Ncp { exit.clone(), blob_recycler.clone(), request_sender, - )?; + ); let (response_sender, response_receiver) = channel(); let t_responder = streamer::responder( "ncp", @@ -57,7 +56,7 @@ impl Ncp { ); let t_gossip = Crdt::gossip(crdt.clone(), blob_recycler, response_sender, exit.clone()); let thread_hdls = vec![t_receiver, t_responder, t_listen, t_gossip]; - Ok(Ncp { exit, thread_hdls }) + Ncp { exit, thread_hdls } } pub fn close(self) -> thread::Result<()> { @@ -95,7 +94,7 @@ mod tests { let crdt = Crdt::new(tn.info.clone()).expect("Crdt::new"); let c = Arc::new(RwLock::new(crdt)); let w = Arc::new(RwLock::new(vec![])); - let d = Ncp::new(&c, w, None, tn.sockets.gossip, exit.clone()).unwrap(); + let d = Ncp::new(&c, w, None, tn.sockets.gossip, exit.clone()); d.close().expect("thread join"); } } diff --git a/src/streamer.rs b/src/streamer.rs index 467478e81b..cf657710a1 100644 --- a/src/streamer.rs +++ b/src/streamer.rs @@ -124,12 +124,13 @@ pub fn blob_receiver( exit: Arc, recycler: BlobRecycler, s: BlobSender, -) -> Result> { +) -> JoinHandle<()> { //DOCUMENTED SIDE-EFFECT //1 second timeout on socket read let timer = Duration::new(1, 0); - sock.set_read_timeout(Some(timer))?; - let t = Builder::new() + sock.set_read_timeout(Some(timer)) + .expect("set socket timeout"); + Builder::new() .name("solana-blob_receiver".to_string()) .spawn(move || loop { if exit.load(Ordering::Relaxed) { @@ -137,8 +138,7 @@ pub fn blob_receiver( } let _ = recv_blobs(&recycler, &sock, &s); }) - .unwrap(); - Ok(t) + .unwrap() } #[cfg(test)] diff --git a/src/thin_client.rs b/src/thin_client.rs index 6e770cfece..38451932d6 100644 --- a/src/thin_client.rs +++ b/src/thin_client.rs @@ -366,7 +366,7 @@ pub fn poll_gossip_for_leader(leader_ncp: SocketAddr, timeout: Option) -> R let (node, gossip_socket) = Crdt::spy_node(); let crdt = Arc::new(RwLock::new(Crdt::new(node).expect("Crdt::new"))); let window = Arc::new(RwLock::new(vec![])); - let ncp = Ncp::new(&crdt.clone(), window, None, gossip_socket, exit.clone()).unwrap(); + let ncp = Ncp::new(&crdt.clone(), window, None, gossip_socket, exit.clone()); let leader_entry_point = NodeInfo::new_entry_point(&leader_ncp); crdt.write().unwrap().insert(&leader_entry_point); diff --git a/src/tvu.rs b/src/tvu.rs index 6f012d1248..f23ec0204b 100644 --- a/src/tvu.rs +++ b/src/tvu.rs @@ -152,7 +152,6 @@ pub mod tests { use mint::Mint; use ncp::Ncp; use packet::BlobRecycler; - use result::Result; use service::Service; use signature::{Keypair, KeypairUtil}; use std::collections::VecDeque; @@ -170,10 +169,10 @@ pub mod tests { crdt: Arc>, gossip: UdpSocket, exit: Arc, - ) -> Result<(Ncp, SharedWindow)> { + ) -> (Ncp, SharedWindow) { let window = window::default_window(); - let ncp = Ncp::new(&crdt, window.clone(), None, gossip, exit)?; - Ok((ncp, window)) + let ncp = Ncp::new(&crdt, window.clone(), None, gossip, exit); + (ncp, window) } /// Test that message sent from leader to target1 and replicated to target2 @@ -191,7 +190,7 @@ pub mod tests { crdt_l.set_leader(leader.info.id); let cref_l = Arc::new(RwLock::new(crdt_l)); - let dr_l = new_ncp(cref_l, leader.sockets.gossip, exit.clone()).unwrap(); + let dr_l = new_ncp(cref_l, leader.sockets.gossip, exit.clone()); //start crdt2 let mut crdt2 = Crdt::new(target2.info.clone()).expect("Crdt::new"); @@ -199,7 +198,7 @@ pub mod tests { crdt2.set_leader(leader.info.id); let leader_id = leader.info.id; let cref2 = Arc::new(RwLock::new(crdt2)); - let dr_2 = new_ncp(cref2, target2.sockets.gossip, exit.clone()).unwrap(); + let dr_2 = new_ncp(cref2, target2.sockets.gossip, exit.clone()); // setup some blob services to send blobs into the socket // to simulate the source peer and get blobs out of the socket to @@ -212,7 +211,7 @@ pub mod tests { exit.clone(), recv_recycler.clone(), s_reader, - ).unwrap(); + ); // simulate leader sending messages let (s_responder, r_responder) = channel(); @@ -233,7 +232,7 @@ pub mod tests { crdt1.insert(&leader.info); crdt1.set_leader(leader.info.id); let cref1 = Arc::new(RwLock::new(crdt1)); - let dr_1 = new_ncp(cref1.clone(), target1.sockets.gossip, exit.clone()).unwrap(); + let dr_1 = new_ncp(cref1.clone(), target1.sockets.gossip, exit.clone()); let tvu = Tvu::new( target1_keypair, diff --git a/src/window.rs b/src/window.rs index 2da2ec7832..715cc3670e 100644 --- a/src/window.rs +++ b/src/window.rs @@ -799,7 +799,7 @@ mod test { exit.clone(), resp_recycler.clone(), s_reader, - ).unwrap(); + ); let (s_window, r_window) = channel(); let (s_retransmit, r_retransmit) = channel(); let win = default_window(); @@ -869,7 +869,7 @@ mod test { exit.clone(), resp_recycler.clone(), s_reader, - ).unwrap(); + ); let (s_window, _r_window) = channel(); let (s_retransmit, r_retransmit) = channel(); let win = default_window(); @@ -932,7 +932,7 @@ mod test { exit.clone(), resp_recycler.clone(), s_reader, - ).unwrap(); + ); let (s_window, _r_window) = channel(); let (s_retransmit, r_retransmit) = channel(); let win = default_window(); diff --git a/tests/data_replicator.rs b/tests/data_replicator.rs index fd9f8ec0f2..408ce08bc6 100644 --- a/tests/data_replicator.rs +++ b/tests/data_replicator.rs @@ -21,7 +21,7 @@ fn test_node(exit: Arc) -> (Arc>, Ncp, UdpSocket) { let crdt = Crdt::new(tn.info.clone()).expect("Crdt::new"); let c = Arc::new(RwLock::new(crdt)); let w = Arc::new(RwLock::new(vec![])); - let d = Ncp::new(&c.clone(), w, None, tn.sockets.gossip, exit).unwrap(); + let d = Ncp::new(&c.clone(), w, None, tn.sockets.gossip, exit); (c, d, tn.sockets.replicate) } diff --git a/tests/multinode.rs b/tests/multinode.rs index c54401401a..0da5d9cc27 100644 --- a/tests/multinode.rs +++ b/tests/multinode.rs @@ -42,7 +42,7 @@ fn converge(leader: &NodeInfo, num_nodes: usize) -> Vec { spy_crdt.set_leader(leader.id); let spy_ref = Arc::new(RwLock::new(spy_crdt)); let spy_window = default_window(); - let ncp = Ncp::new(&spy_ref, spy_window, None, spy.sockets.gossip, exit.clone()).unwrap(); + let ncp = Ncp::new(&spy_ref, spy_window, None, spy.sockets.gossip, exit.clone()); //wait for the network to converge let mut converged = false; let mut rv = vec![];