@@ -9,7 +9,7 @@ use crate::{
99 fiber:: {
1010 gossip:: { GossipActorMessage , GossipMessageStore } ,
1111 graph:: ChannelUpdateInfo ,
12- network:: { AcceptChannelCommand , NetworkActorStateStore , OpenChannelCommand } ,
12+ network:: { AcceptChannelCommand , DebugEvent , NetworkActorStateStore , OpenChannelCommand } ,
1313 payment:: { SendPaymentCommand , SendPaymentDataExt } ,
1414 types:: {
1515 broadcast_message_to_gossip, BroadcastMessageWithTimestamp ,
@@ -750,15 +750,25 @@ async fn test_peer_disconnect_without_active_channel_skips_backoff_reconnect() {
750750 init_tracing ( ) ;
751751
752752 let [ mut node1, mut node2] = NetworkNode :: new_n_interconnected_nodes ( ) . await ;
753+ let saw_debug = std:: cell:: Cell :: new ( false ) ;
754+ let saw_disconnect = std:: cell:: Cell :: new ( false ) ;
753755
754756 node2. stop ( ) . await ;
755757
756758 node1
757- . expect_debug_event ( "PeerReconnectBackoffSkippedNoDirectChannel" )
758- . await ;
759- node1
760- . expect_event ( |event| {
761- matches ! ( event, NetworkServiceEvent :: PeerDisConnected ( id, _) if id == & node2. pubkey)
759+ . expect_to_process_event ( |event| {
760+ match event {
761+ NetworkServiceEvent :: DebugEvent ( DebugEvent :: Common ( msg) )
762+ if msg == "PeerReconnectBackoffSkippedNoDirectChannel" =>
763+ {
764+ saw_debug. set ( true ) ;
765+ }
766+ NetworkServiceEvent :: PeerDisConnected ( id, _) if id == & node2. pubkey => {
767+ saw_disconnect. set ( true ) ;
768+ }
769+ _ => { }
770+ }
771+ ( saw_debug. get ( ) && saw_disconnect. get ( ) ) . then_some ( ( ) )
762772 } )
763773 . await ;
764774}
0 commit comments