@@ -27,7 +27,7 @@ use util::test_utils::{panicking, TestChainMonitor};
27
27
use util:: events:: { Event , MessageSendEvent , MessageSendEventsProvider , PaymentPurpose } ;
28
28
use util:: errors:: APIError ;
29
29
use util:: config:: UserConfig ;
30
- use util:: ser:: { ReadableArgs , Writeable , Readable } ;
30
+ use util:: ser:: { ReadableArgs , Writeable } ;
31
31
32
32
use bitcoin:: blockdata:: block:: { Block , BlockHeader } ;
33
33
use bitcoin:: blockdata:: constants:: genesis_block;
@@ -257,7 +257,6 @@ pub struct TestChanMonCfg {
257
257
pub persister : test_utils:: TestPersister ,
258
258
pub logger : test_utils:: TestLogger ,
259
259
pub keys_manager : test_utils:: TestKeysInterface ,
260
- pub network_graph : NetworkGraph ,
261
260
}
262
261
263
262
pub struct NodeCfg < ' a > {
@@ -267,7 +266,7 @@ pub struct NodeCfg<'a> {
267
266
pub chain_monitor : test_utils:: TestChainMonitor < ' a > ,
268
267
pub keys_manager : & ' a test_utils:: TestKeysInterface ,
269
268
pub logger : & ' a test_utils:: TestLogger ,
270
- pub network_graph : & ' a NetworkGraph ,
269
+ pub network_graph : NetworkGraph < & ' a test_utils :: TestLogger > ,
271
270
pub node_seed : [ u8 ; 32 ] ,
272
271
pub features : InitFeatures ,
273
272
}
@@ -278,8 +277,8 @@ pub struct Node<'a, 'b: 'a, 'c: 'b> {
278
277
pub chain_monitor : & ' b test_utils:: TestChainMonitor < ' c > ,
279
278
pub keys_manager : & ' b test_utils:: TestKeysInterface ,
280
279
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
- pub network_graph : & ' c NetworkGraph ,
282
- pub gossip_sync : P2PGossipSync < & ' c NetworkGraph , & ' c test_utils:: TestChainSource , & ' c test_utils:: TestLogger > ,
280
+ pub network_graph : & ' b NetworkGraph < & ' c test_utils :: TestLogger > ,
281
+ pub gossip_sync : P2PGossipSync < & ' b NetworkGraph < & ' c test_utils :: TestLogger > , & ' c test_utils:: TestChainSource , & ' c test_utils:: TestLogger > ,
283
282
pub node_seed : [ u8 ; 32 ] ,
284
283
pub network_payment_count : Rc < RefCell < u8 > > ,
285
284
pub network_chan_count : Rc < RefCell < u32 > > ,
@@ -311,7 +310,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
311
310
{
312
311
let mut w = test_utils:: TestVecWriter ( Vec :: new ( ) ) ;
313
312
self . network_graph . write ( & mut w) . unwrap ( ) ;
314
- let network_graph_deser = <NetworkGraph > :: read ( & mut io:: Cursor :: new ( & w. 0 ) ) . unwrap ( ) ;
313
+ let network_graph_deser = <NetworkGraph < _ > > :: read ( & mut io:: Cursor :: new ( & w. 0 ) , self . logger ) . unwrap ( ) ;
315
314
assert ! ( network_graph_deser == * self . network_graph) ;
316
315
let gossip_sync = P2PGossipSync :: new (
317
316
& network_graph_deser, Some ( self . chain_source ) , self . logger
@@ -1923,9 +1922,8 @@ pub fn create_chanmon_cfgs(node_count: usize) -> Vec<TestChanMonCfg> {
1923
1922
let persister = test_utils:: TestPersister :: new ( ) ;
1924
1923
let seed = [ i as u8 ; 32 ] ;
1925
1924
let keys_manager = test_utils:: TestKeysInterface :: new ( & seed, Network :: Testnet ) ;
1926
- let network_graph = NetworkGraph :: new ( chain_source. genesis_hash ) ;
1927
1925
1928
- chan_mon_cfgs. push ( TestChanMonCfg { tx_broadcaster, fee_estimator, chain_source, logger, persister, keys_manager, network_graph } ) ;
1926
+ chan_mon_cfgs. push ( TestChanMonCfg { tx_broadcaster, fee_estimator, chain_source, logger, persister, keys_manager } ) ;
1929
1927
}
1930
1928
1931
1929
chan_mon_cfgs
@@ -1946,7 +1944,7 @@ pub fn create_node_cfgs<'a>(node_count: usize, chanmon_cfgs: &'a Vec<TestChanMon
1946
1944
keys_manager : & chanmon_cfgs[ i] . keys_manager ,
1947
1945
node_seed : seed,
1948
1946
features : InitFeatures :: known ( ) ,
1949
- network_graph : & chanmon_cfgs[ i] . network_graph ,
1947
+ network_graph : NetworkGraph :: new ( chanmon_cfgs [ i ] . chain_source . genesis_hash , & chanmon_cfgs[ i] . logger ) ,
1950
1948
} ) ;
1951
1949
}
1952
1950
@@ -1992,7 +1990,7 @@ pub fn create_network<'a, 'b: 'a, 'c: 'b>(node_count: usize, cfgs: &'b Vec<NodeC
1992
1990
let connect_style = Rc :: new ( RefCell :: new ( ConnectStyle :: random_style ( ) ) ) ;
1993
1991
1994
1992
for i in 0 ..node_count {
1995
- let gossip_sync = P2PGossipSync :: new ( cfgs[ i] . network_graph , None , cfgs[ i] . logger ) ;
1993
+ let gossip_sync = P2PGossipSync :: new ( & cfgs[ i] . network_graph , None , cfgs[ i] . logger ) ;
1996
1994
nodes. push ( Node {
1997
1995
chain_source : cfgs[ i] . chain_source , tx_broadcaster : cfgs[ i] . tx_broadcaster ,
1998
1996
chain_monitor : & cfgs[ i] . chain_monitor , keys_manager : & cfgs[ i] . keys_manager ,
0 commit comments