@@ -15,7 +15,7 @@ use chain::channelmonitor::ChannelMonitor;
1515use chain:: transaction:: OutPoint ;
1616use ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
1717use ln:: channelmanager:: { ChainParameters , ChannelManager , ChannelManagerReadArgs , RAACommitmentOrder , PaymentSendFailure , PaymentId , MIN_CLTV_EXPIRY_DELTA } ;
18- use routing:: network_graph:: { NetGraphMsgHandler , NetworkGraph } ;
18+ use routing:: network_graph:: { P2PGossipSync , NetworkGraph } ;
1919use routing:: router:: { PaymentParameters , Route , get_route} ;
2020use ln:: features:: { InitFeatures , InvoiceFeatures } ;
2121use ln:: msgs;
@@ -279,7 +279,7 @@ pub struct Node<'a, 'b: 'a, 'c: 'b> {
279279 pub keys_manager : & ' b test_utils:: TestKeysInterface ,
280280 pub node : & ' a ChannelManager < EnforcingSigner , & ' b TestChainMonitor < ' c > , & ' c test_utils:: TestBroadcaster , & ' b test_utils:: TestKeysInterface , & ' c test_utils:: TestFeeEstimator , & ' c test_utils:: TestLogger > ,
281281 pub network_graph : & ' c NetworkGraph ,
282- pub net_graph_msg_handler : NetGraphMsgHandler < & ' c NetworkGraph , & ' c test_utils:: TestChainSource , & ' c test_utils:: TestLogger > ,
282+ pub gossip_sync : P2PGossipSync < & ' c NetworkGraph , & ' c test_utils:: TestChainSource , & ' c test_utils:: TestLogger > ,
283283 pub node_seed : [ u8 ; 32 ] ,
284284 pub network_payment_count : Rc < RefCell < u8 > > ,
285285 pub network_chan_count : Rc < RefCell < u32 > > ,
@@ -313,13 +313,13 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
313313 self . network_graph . write ( & mut w) . unwrap ( ) ;
314314 let network_graph_deser = <NetworkGraph >:: read ( & mut io:: Cursor :: new ( & w. 0 ) ) . unwrap ( ) ;
315315 assert ! ( network_graph_deser == * self . network_graph) ;
316- let net_graph_msg_handler = NetGraphMsgHandler :: new (
316+ let gossip_sync = P2PGossipSync :: new (
317317 & network_graph_deser, Some ( self . chain_source ) , self . logger
318318 ) ;
319319 let mut chan_progress = 0 ;
320320 loop {
321- let orig_announcements = self . net_graph_msg_handler . get_next_channel_announcements ( chan_progress, 255 ) ;
322- let deserialized_announcements = net_graph_msg_handler . get_next_channel_announcements ( chan_progress, 255 ) ;
321+ let orig_announcements = self . gossip_sync . get_next_channel_announcements ( chan_progress, 255 ) ;
322+ let deserialized_announcements = gossip_sync . get_next_channel_announcements ( chan_progress, 255 ) ;
323323 assert ! ( orig_announcements == deserialized_announcements) ;
324324 chan_progress = match orig_announcements. last ( ) {
325325 Some ( announcement) => announcement. 0 . contents . short_channel_id + 1 ,
@@ -328,8 +328,8 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
328328 }
329329 let mut node_progress = None ;
330330 loop {
331- let orig_announcements = self . net_graph_msg_handler . get_next_node_announcements ( node_progress. as_ref ( ) , 255 ) ;
332- let deserialized_announcements = net_graph_msg_handler . get_next_node_announcements ( node_progress. as_ref ( ) , 255 ) ;
331+ let orig_announcements = self . gossip_sync . get_next_node_announcements ( node_progress. as_ref ( ) , 255 ) ;
332+ let deserialized_announcements = gossip_sync . get_next_node_announcements ( node_progress. as_ref ( ) , 255 ) ;
333333 assert ! ( orig_announcements == deserialized_announcements) ;
334334 node_progress = match orig_announcements. last ( ) {
335335 Some ( announcement) => Some ( announcement. contents . node_id ) ,
@@ -876,11 +876,11 @@ pub fn update_nodes_with_chan_announce<'a, 'b, 'c, 'd>(nodes: &'a Vec<Node<'b, '
876876 } ;
877877
878878 for node in nodes {
879- assert ! ( node. net_graph_msg_handler . handle_channel_announcement( ann) . unwrap( ) ) ;
880- node. net_graph_msg_handler . handle_channel_update ( upd_1) . unwrap ( ) ;
881- node. net_graph_msg_handler . handle_channel_update ( upd_2) . unwrap ( ) ;
882- node. net_graph_msg_handler . handle_node_announcement ( & a_node_announcement) . unwrap ( ) ;
883- node. net_graph_msg_handler . handle_node_announcement ( & b_node_announcement) . unwrap ( ) ;
879+ assert ! ( node. gossip_sync . handle_channel_announcement( ann) . unwrap( ) ) ;
880+ node. gossip_sync . handle_channel_update ( upd_1) . unwrap ( ) ;
881+ node. gossip_sync . handle_channel_update ( upd_2) . unwrap ( ) ;
882+ node. gossip_sync . handle_node_announcement ( & a_node_announcement) . unwrap ( ) ;
883+ node. gossip_sync . handle_node_announcement ( & b_node_announcement) . unwrap ( ) ;
884884
885885 // Note that channel_updates are also delivered to ChannelManagers to ensure we have
886886 // forwarding info for local channels even if its not accepted in the network graph.
@@ -1992,11 +1992,11 @@ pub fn create_network<'a, 'b: 'a, 'c: 'b>(node_count: usize, cfgs: &'b Vec<NodeC
19921992 let connect_style = Rc :: new ( RefCell :: new ( ConnectStyle :: random_style ( ) ) ) ;
19931993
19941994 for i in 0 ..node_count {
1995- let net_graph_msg_handler = NetGraphMsgHandler :: new ( cfgs[ i] . network_graph , None , cfgs[ i] . logger ) ;
1995+ let gossip_sync = P2PGossipSync :: new ( cfgs[ i] . network_graph , None , cfgs[ i] . logger ) ;
19961996 nodes. push ( Node {
19971997 chain_source : cfgs[ i] . chain_source , tx_broadcaster : cfgs[ i] . tx_broadcaster ,
19981998 chain_monitor : & cfgs[ i] . chain_monitor , keys_manager : & cfgs[ i] . keys_manager ,
1999- node : & chan_mgrs[ i] , network_graph : & cfgs[ i] . network_graph , net_graph_msg_handler ,
1999+ node : & chan_mgrs[ i] , network_graph : & cfgs[ i] . network_graph , gossip_sync ,
20002000 node_seed : cfgs[ i] . node_seed , network_chan_count : chan_count. clone ( ) ,
20012001 network_payment_count : payment_count. clone ( ) , logger : cfgs[ i] . logger ,
20022002 blocks : Arc :: clone ( & cfgs[ i] . tx_broadcaster . blocks ) ,
@@ -2160,8 +2160,8 @@ pub fn handle_announce_close_broadcast_events<'a, 'b, 'c>(nodes: &Vec<Node<'a, '
21602160 }
21612161
21622162 for node in nodes {
2163- node. net_graph_msg_handler . handle_channel_update ( & as_update) . unwrap ( ) ;
2164- node. net_graph_msg_handler . handle_channel_update ( & bs_update) . unwrap ( ) ;
2163+ node. gossip_sync . handle_channel_update ( & as_update) . unwrap ( ) ;
2164+ node. gossip_sync . handle_channel_update ( & bs_update) . unwrap ( ) ;
21652165 }
21662166}
21672167
0 commit comments