@@ -48,7 +48,7 @@ struct DirectionalChannelInfo {
48
48
49
49
impl std:: fmt:: Display for DirectionalChannelInfo {
50
50
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
51
- write ! ( f, " node id {} last_update {} enabled {} cltv_expiry_delta {} htlc_minimum_msat {} fee_base_msat {} fee_proportional_millionths {}\n " , log_pubkey!( self . src_node_id) , self . last_update, self . enabled, self . cltv_expiry_delta, self . htlc_minimum_msat, self . fee_base_msat, self . fee_proportional_millionths) ?;
51
+ write ! ( f, "src_node_id {}, last_update {}, enabled {}, cltv_expiry_delta {}, htlc_minimum_msat {}, fee_base_msat {}, fee_proportional_millionths {}" , log_pubkey!( self . src_node_id) , self . last_update, self . enabled, self . cltv_expiry_delta, self . htlc_minimum_msat, self . fee_base_msat, self . fee_proportional_millionths) ?;
52
52
Ok ( ( ) )
53
53
}
54
54
}
@@ -61,9 +61,7 @@ struct ChannelInfo {
61
61
62
62
impl std:: fmt:: Display for ChannelInfo {
63
63
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
64
- //TODO: GlobalFeatures
65
- write ! ( f, " one_to_two {}" , self . one_to_two) ?;
66
- write ! ( f, " two_to_one {}" , self . two_to_one) ?;
64
+ write ! ( f, "features: {}, one_to_two: {}, two_to_one: {}" , log_bytes!( self . features. encode( ) ) , self . one_to_two, self . two_to_one) ?;
67
65
Ok ( ( ) )
68
66
}
69
67
}
@@ -86,13 +84,7 @@ struct NodeInfo {
86
84
87
85
impl std:: fmt:: Display for NodeInfo {
88
86
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
89
- write ! ( f, " Channels\n " ) ?;
90
- for c in self . channels . iter ( ) {
91
- write ! ( f, " {}\n " , c) ?;
92
- }
93
- write ! ( f, " lowest_inbound_channel_fee_base_msat {}\n " , self . lowest_inbound_channel_fee_base_msat) ?;
94
- write ! ( f, " lowest_inbound_channel_fee_proportional_millionths {}\n " , self . lowest_inbound_channel_fee_proportional_millionths) ?;
95
- //TODO: GlobalFeatures, last_update, rgb, alias, addresses
87
+ write ! ( f, "features: {}, last_update: {}, lowest_inbound_channel_fee_base_msat: {}, lowest_inbound_channel_fee_proportional_millionths: {}, channels: {:?}" , log_bytes!( self . features. encode( ) ) , self . last_update, self . lowest_inbound_channel_fee_base_msat, self . lowest_inbound_channel_fee_proportional_millionths, & self . channels[ ..] ) ?;
96
88
Ok ( ( ) )
97
89
}
98
90
}
@@ -111,11 +103,11 @@ impl std::fmt::Display for NetworkMap {
111
103
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
112
104
write ! ( f, "Node id {} network map\n [Channels]\n " , log_pubkey!( self . our_node_id) ) ?;
113
105
for ( key, val) in self . channels . iter ( ) {
114
- write ! ( f, " {} : \n {}\n " , key, val) ?;
106
+ write ! ( f, " {}: {}\n " , key, val) ?;
115
107
}
116
108
write ! ( f, "[Nodes]\n " ) ?;
117
109
for ( key, val) in self . nodes . iter ( ) {
118
- write ! ( f, " {} : \n {}\n " , log_pubkey!( key) , val) ?;
110
+ write ! ( f, " {}: {}\n " , log_pubkey!( key) , val) ?;
119
111
}
120
112
Ok ( ( ) )
121
113
}
@@ -414,6 +406,12 @@ impl Router {
414
406
}
415
407
}
416
408
409
+ /// Dumps the entire network view of this Router to the logger provided in the constructor at
410
+ /// level Trace
411
+ pub fn trace_state ( & self ) {
412
+ log_trace ! ( self , "{}" , self . network_map. read( ) . unwrap( ) ) ;
413
+ }
414
+
417
415
/// Get network addresses by node id
418
416
pub fn get_addresses ( & self , pubkey : & PublicKey ) -> Option < Vec < NetAddress > > {
419
417
let network = self . network_map . read ( ) . unwrap ( ) ;
@@ -610,9 +608,9 @@ impl Router {
610
608
}
611
609
res. last_mut ( ) . unwrap ( ) . fee_msat = final_value_msat;
612
610
res. last_mut ( ) . unwrap ( ) . cltv_expiry_delta = final_cltv;
613
- return Ok ( Route {
614
- hops : res
615
- } ) ;
611
+ let route = Route { hops : res } ;
612
+ log_trace ! ( self , "Got route: {}" , log_route! ( route ) ) ;
613
+ return Ok ( route ) ;
616
614
}
617
615
618
616
match network. nodes . get ( & pubkey) {
0 commit comments