From 98438fd0e5250d80067bf044a140e13952611432 Mon Sep 17 00:00:00 2001 From: boqiu <82121246@qq.com> Date: Fri, 25 Oct 2024 11:31:54 +0800 Subject: [PATCH] fmt code --- node/router/src/libp2p_event_handler.rs | 3 ++- node/sync/src/controllers/serial.rs | 5 ++++- node/sync/src/service.rs | 12 +++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/node/router/src/libp2p_event_handler.rs b/node/router/src/libp2p_event_handler.rs index fa62a5f..ef6cf02 100644 --- a/node/router/src/libp2p_event_handler.rs +++ b/node/router/src/libp2p_event_handler.rs @@ -398,7 +398,8 @@ impl Libp2pEventHandler { }; // update shard config cache - self.file_location_cache.insert_peer_config(from, announced_shard_config); + self.file_location_cache + .insert_peer_config(from, announced_shard_config); // ignore if already exists match self.store.check_tx_completed(msg.tx_id.seq).await { diff --git a/node/sync/src/controllers/serial.rs b/node/sync/src/controllers/serial.rs index acb5bff..3c75082 100644 --- a/node/sync/src/controllers/serial.rs +++ b/node/sync/src/controllers/serial.rs @@ -1543,7 +1543,10 @@ mod tests { controller.on_response(peer_id, chunks).await; assert_eq!(*controller.get_status(), SyncState::Completed); - assert!(matches!(network_recv.try_recv().unwrap(), NetworkMessage::AnnounceLocalFile { .. })); + assert!(matches!( + network_recv.try_recv().unwrap(), + NetworkMessage::AnnounceLocalFile { .. } + )); assert!(network_recv.try_recv().is_err()); } diff --git a/node/sync/src/service.rs b/node/sync/src/service.rs index e119f5e..d155b46 100644 --- a/node/sync/src/service.rs +++ b/node/sync/src/service.rs @@ -1558,7 +1558,10 @@ mod tests { .await; wait_for_tx_finalized(runtime.store.clone(), tx_seq).await; - assert!(matches!(runtime.network_recv.try_recv().unwrap(), NetworkMessage::AnnounceLocalFile { .. })); + assert!(matches!( + runtime.network_recv.try_recv().unwrap(), + NetworkMessage::AnnounceLocalFile { .. } + )); assert!(!runtime.store.check_tx_completed(0).unwrap()); @@ -1568,7 +1571,7 @@ mod tests { .request(SyncRequest::SyncFile { tx_seq }) .await .unwrap(); - + receive_dial(&mut runtime, &sync_send).await; receive_chunk_request( @@ -1583,7 +1586,10 @@ mod tests { .await; wait_for_tx_finalized(runtime.store, tx_seq).await; - assert!(matches!(runtime.network_recv.try_recv().unwrap(), NetworkMessage::AnnounceLocalFile { .. })); + assert!(matches!( + runtime.network_recv.try_recv().unwrap(), + NetworkMessage::AnnounceLocalFile { .. } + )); sync_send .notify(SyncMessage::PeerDisconnected {