From e17a41b65e67a674ec579550c5b0c45536120f3a Mon Sep 17 00:00:00 2001 From: YI Date: Thu, 19 Dec 2024 19:13:38 +0800 Subject: [PATCH] Reduce some noice in output --- src/ckb/tests/test_utils.rs | 10 ---------- src/fiber/gossip.rs | 13 ++++++++----- src/fiber/graph.rs | 14 ++++++-------- src/fiber/network.rs | 1 - 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/ckb/tests/test_utils.rs b/src/ckb/tests/test_utils.rs index fc3329dc..b9fcd731 100644 --- a/src/ckb/tests/test_utils.rs +++ b/src/ckb/tests/test_utils.rs @@ -310,7 +310,6 @@ impl Actor for MockChainActor { message: Self::Msg, state: &mut Self::State, ) -> Result<(), ActorProcessingErr> { - debug!("MockChainActor received message: {:?}", message); use CkbChainMessage::*; match message { Fund(tx, request, reply_port) => { @@ -437,10 +436,6 @@ impl Actor for MockChainActor { let index = index as usize; let cell = tx.outputs().get(index).unwrap(); let data = tx.outputs_data().get(index).unwrap(); - debug!( - "Creating cell with outpoint: {:?}, cell: {:?}, data: {:?}", - outpoint, cell, data - ); context.create_cell_with_out_point( outpoint.clone(), cell, @@ -515,11 +510,6 @@ impl Actor for MockChainActor { .entry(request.block_hash()) .or_insert(now_timestamp_as_millis_u64()); - debug!( - "Get block timestamp: block_hash: {:?}, timestamp: {}", - request.block_hash(), - timestamp - ); let _ = rpc_reply_port.send(Ok(Some(timestamp))); } } diff --git a/src/fiber/gossip.rs b/src/fiber/gossip.rs index 64c04a5f..4ce90eeb 100644 --- a/src/fiber/gossip.rs +++ b/src/fiber/gossip.rs @@ -550,7 +550,7 @@ where GossipSyncingActorMessage::NewGetRequest() => { let latest_cursor = state.get_cursor().clone(); let request_id = state.get_and_increment_request_id(); - debug!( + trace!( "Sending GetBroadcastMessages request to peers: request_id {}, latest_cursor {:?}", request_id, latest_cursor ); @@ -1231,9 +1231,10 @@ impl Actor for ExtendedGossipMess .send((id, tx, Arc::clone(&output_port))) .expect("send reply"); rx.await.expect("receive notification"); - debug!( + trace!( "Loading messages from store for subscriber {}: subscription cursor {:?}", - id, cursor + id, + cursor ); // Since the handling of LoadMessagesFromStore interleaves with the handling of Tick, // we may send the messages in an order that is different from both the dependency order @@ -1348,6 +1349,9 @@ impl Actor for ExtendedGossipMess // These are the messages that have complete dependencies and can be sent to the subscribers. let complete_messages = state.prune_messages_to_be_saved().await; + if complete_messages.is_empty() { + return Ok(()); + } for (id, subscription) in state.output_ports.iter() { let messages_to_send = complete_messages .iter() @@ -2417,13 +2421,12 @@ where GossipActorMessage::TickNetworkMaintenance => { trace!( - "Gossip network maintenance ticked, current state: num of peers: {}, num of finished syncing peers: {}, num of active syncing peers: {}, num of passive syncing peers: {}, num of pending queries: {}, peer states: {:?}", + "Gossip network maintenance ticked, current state: num of peers: {}, num of finished syncing peers: {}, num of active syncing peers: {}, num of passive syncing peers: {}, num of pending queries: {}", state.peer_states.len(), state.num_finished_active_syncing_peers, state.num_of_active_syncing_peers(), state.num_of_passive_syncing_peers(), state.pending_queries.len(), - &state.peer_states ); for peer in state.peers_to_start_active_syncing() { state.start_new_active_syncer(&peer).await; diff --git a/src/fiber/graph.rs b/src/fiber/graph.rs index 3adeaa28..bede9531 100644 --- a/src/fiber/graph.rs +++ b/src/fiber/graph.rs @@ -264,7 +264,7 @@ where if messages.is_empty() { return false; } - debug!("Updating network graph with #{} messages", messages.len()); + debug!("Updating network graph with {} messages", messages.len()); for message in messages { self.update_lastest_cursor(message.cursor()); if message.chain_hash() != get_chain_hash() { @@ -330,7 +330,6 @@ where } fn load_channel_info_mut(&mut self, channel_outpoint: &OutPoint) -> Option<&mut ChannelInfo> { - debug!("Loading channel info: {:?}", channel_outpoint); if !self.channels.contains_key(channel_outpoint) { if let Some((timestamp, channel_announcement)) = self.store.get_latest_channel_announcement(channel_outpoint) @@ -350,10 +349,6 @@ where timestamp: u64, channel_announcement: ChannelAnnouncement, ) -> Option { - debug!( - "Processing channel announcement: timestamp {}, channel announcement {:?}", - timestamp, &channel_announcement - ); match self.channels.get(&channel_announcement.channel_outpoint) { Some(_channel) => { trace!( @@ -369,7 +364,7 @@ where channel_announcement.channel_outpoint.clone(), ), ); - debug!( + trace!( "Inserting new channel announcement: {:?}", &channel_announcement ); @@ -394,7 +389,6 @@ where } fn process_channel_update(&mut self, channel_update: ChannelUpdate) -> Option { - debug!("Processing channel update: {:?}", &channel_update); let channel_outpoint = &channel_update.channel_outpoint; // The channel update message may have smaller timestamp than channel announcement. // So it is possible that the channel announcement is not loaded into the graph yet, @@ -420,6 +414,10 @@ where channel_update.timestamp, BroadcastMessageID::ChannelUpdate(channel_update.channel_outpoint.clone()), ); + trace!( + "Saving new channel update to the graph: {:?}", + &channel_update + ); *update_info = Some(ChannelUpdateInfo::from(channel_update)); return Some(cursor); } diff --git a/src/fiber/network.rs b/src/fiber/network.rs index ac7952ec..8db727b4 100644 --- a/src/fiber/network.rs +++ b/src/fiber/network.rs @@ -893,7 +893,6 @@ where )); } NetworkActorEvent::GossipMessageUpdates(gossip_message_updates) => { - trace!("Network actor received gossip updates, updating graph"); let mut graph = self.network_graph.write().await; graph.update_for_messages(gossip_message_updates.messages); }