@@ -15,7 +15,7 @@ use chain::channelmonitor::ChannelMonitor;
15
15
use chain:: transaction:: OutPoint ;
16
16
use ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
17
17
use 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 } ;
19
19
use routing:: router:: { PaymentParameters , Route , get_route} ;
20
20
use ln:: features:: { InitFeatures , InvoiceFeatures } ;
21
21
use ln:: msgs;
@@ -279,7 +279,7 @@ pub struct Node<'a, 'b: 'a, 'c: 'b> {
279
279
pub keys_manager : & ' b test_utils:: TestKeysInterface ,
280
280
pub node : & ' a ChannelManager < EnforcingSigner , & ' b TestChainMonitor < ' c > , & ' c test_utils:: TestBroadcaster , & ' b test_utils:: TestKeysInterface , & ' c test_utils:: TestFeeEstimator , & ' c test_utils:: TestLogger > ,
281
281
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 > ,
283
283
pub node_seed : [ u8 ; 32 ] ,
284
284
pub network_payment_count : Rc < RefCell < u8 > > ,
285
285
pub network_chan_count : Rc < RefCell < u32 > > ,
@@ -313,13 +313,13 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
313
313
self . network_graph . write ( & mut w) . unwrap ( ) ;
314
314
let network_graph_deser = <NetworkGraph >:: read ( & mut io:: Cursor :: new ( & w. 0 ) ) . unwrap ( ) ;
315
315
assert ! ( network_graph_deser == * self . network_graph) ;
316
- let net_graph_msg_handler = NetGraphMsgHandler :: new (
316
+ let gossip_sync = P2PGossipSync :: new (
317
317
& network_graph_deser, Some ( self . chain_source ) , self . logger
318
318
) ;
319
319
let mut chan_progress = 0 ;
320
320
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 ) ;
323
323
assert ! ( orig_announcements == deserialized_announcements) ;
324
324
chan_progress = match orig_announcements. last ( ) {
325
325
Some ( announcement) => announcement. 0 . contents . short_channel_id + 1 ,
@@ -328,8 +328,8 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
328
328
}
329
329
let mut node_progress = None ;
330
330
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 ) ;
333
333
assert ! ( orig_announcements == deserialized_announcements) ;
334
334
node_progress = match orig_announcements. last ( ) {
335
335
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, '
876
876
} ;
877
877
878
878
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 ( ) ;
884
884
885
885
// Note that channel_updates are also delivered to ChannelManagers to ensure we have
886
886
// 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
1992
1992
let connect_style = Rc :: new ( RefCell :: new ( ConnectStyle :: random_style ( ) ) ) ;
1993
1993
1994
1994
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 ) ;
1996
1996
nodes. push ( Node {
1997
1997
chain_source : cfgs[ i] . chain_source , tx_broadcaster : cfgs[ i] . tx_broadcaster ,
1998
1998
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 ,
2000
2000
node_seed : cfgs[ i] . node_seed , network_chan_count : chan_count. clone ( ) ,
2001
2001
network_payment_count : payment_count. clone ( ) , logger : cfgs[ i] . logger ,
2002
2002
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, '
2160
2160
}
2161
2161
2162
2162
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 ( ) ;
2165
2165
}
2166
2166
}
2167
2167
0 commit comments