diff --git a/crates/floresta-wire/src/p2p_wire/chain_selector.rs b/crates/floresta-wire/src/p2p_wire/chain_selector.rs index a7f76fe0..1ff47083 100644 --- a/crates/floresta-wire/src/p2p_wire/chain_selector.rs +++ b/crates/floresta-wire/src/p2p_wire/chain_selector.rs @@ -652,6 +652,7 @@ where } pub async fn run(&mut self, stop_signal: Arc>) -> Result<(), WireError> { + println!("CHAIN SELECTOR"); self.create_connection(false).await; info!("Starting ibd, selecting the best chain"); @@ -676,6 +677,8 @@ where let new_sync_peer = rand::random::() % self.peer_ids.len(); self.1.sync_peer = *self.peer_ids.get(new_sync_peer).unwrap(); + println!("REQUESTING BLOCKS"); + try_and_log!( self.request_headers(self.chain.get_best_block()?.1, self.1.sync_peer) .await @@ -780,6 +783,7 @@ where } PeerMessages::Ready(version) => { + println!("FROM PEER: READY"); self.handle_peer_ready(peer, &version).await?; } diff --git a/crates/floresta-wire/src/p2p_wire/running_node.rs b/crates/floresta-wire/src/p2p_wire/running_node.rs index d2a50853..a9c9df76 100644 --- a/crates/floresta-wire/src/p2p_wire/running_node.rs +++ b/crates/floresta-wire/src/p2p_wire/running_node.rs @@ -295,6 +295,7 @@ where kill_signal: Arc>, stop_signal: futures::channel::oneshot::Sender<()>, ) { + println!("RUNNING NODE"); try_and_log!(self.init_peers().await); let startup_tip = self.chain.get_height().unwrap(); diff --git a/crates/floresta-wire/src/p2p_wire/tests/running_node.rs b/crates/floresta-wire/src/p2p_wire/tests/running_node.rs index 98166fb0..65ba08d2 100644 --- a/crates/floresta-wire/src/p2p_wire/tests/running_node.rs +++ b/crates/floresta-wire/src/p2p_wire/tests/running_node.rs @@ -1,6 +1,7 @@ #[cfg(test)] mod tests_utils { use std::collections::HashMap; + use std::mem::ManuallyDrop; use std::sync::Arc; use std::time::Duration; @@ -60,6 +61,7 @@ mod tests_utils { node.peers.insert(i as u32, peer); } // let mut node = ManuallyDrop::new(Box::new(node)); + let node = Box::new(node); let kill_signal = Arc::new(RwLock::new(false)); // FIXME: This doesn't look very safe, but we need to coerce a &mut reference of the node @@ -76,7 +78,7 @@ mod tests_utils { task::spawn(node.run(kill_signal.clone(), sender)); - task::sleep(Duration::from_secs(3)).await; + task::sleep(Duration::from_secs(4)).await; let mut kill_guard = kill_signal.write().await; *kill_guard = true; diff --git a/crates/floresta-wire/src/p2p_wire/tests/utils.rs b/crates/floresta-wire/src/p2p_wire/tests/utils.rs index fa0fe75d..7b67f6be 100644 --- a/crates/floresta-wire/src/p2p_wire/tests/utils.rs +++ b/crates/floresta-wire/src/p2p_wire/tests/utils.rs @@ -95,6 +95,7 @@ impl TestPeer { .unwrap(); loop { + println!("RECEIVING"); let req = self.node_rx.recv().await.unwrap(); match req {