@@ -126,7 +126,7 @@ pub struct NetworkGraph<L: Deref> where L::Target: Logger {
126
126
secp_ctx : Secp256k1 < secp256k1:: VerifyOnly > ,
127
127
last_rapid_gossip_sync_timestamp : Mutex < Option < u32 > > ,
128
128
genesis_hash : BlockHash ,
129
- _logger : L ,
129
+ logger : L ,
130
130
// Lock order: channels -> nodes
131
131
channels : RwLock < BTreeMap < u64 , ChannelInfo > > ,
132
132
nodes : RwLock < BTreeMap < NodeId , NodeInfo > > ,
@@ -248,29 +248,27 @@ where C::Target: chain::Access, L::Target: Logger
248
248
}
249
249
}
250
250
251
- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > EventHandler for ( & G , & L )
252
- where L :: Target : Logger {
251
+ impl < L : Deref > EventHandler for NetworkGraph < L > where L :: Target : Logger {
253
252
fn handle_event ( & self , event : & Event ) {
254
253
if let Event :: PaymentPathFailed { payment_hash : _, rejected_by_dest : _, network_update, .. } = event {
255
254
if let Some ( network_update) = network_update {
256
- let ( network_graph, logger) = self ;
257
255
match * network_update {
258
256
NetworkUpdate :: ChannelUpdateMessage { ref msg } => {
259
257
let short_channel_id = msg. contents . short_channel_id ;
260
258
let is_enabled = msg. contents . flags & ( 1 << 1 ) != ( 1 << 1 ) ;
261
259
let status = if is_enabled { "enabled" } else { "disabled" } ;
262
- log_debug ! ( logger, "Updating channel with channel_update from a payment failure. Channel {} is {}." , short_channel_id, status) ;
263
- let _ = network_graph . update_channel ( msg) ;
260
+ log_debug ! ( self . logger, "Updating channel with channel_update from a payment failure. Channel {} is {}." , short_channel_id, status) ;
261
+ let _ = self . update_channel ( msg) ;
264
262
} ,
265
263
NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent } => {
266
264
let action = if is_permanent { "Removing" } else { "Disabling" } ;
267
- log_debug ! ( logger, "{} channel graph entry for {} due to a payment failure." , action, short_channel_id) ;
268
- network_graph . channel_failed ( short_channel_id, is_permanent) ;
265
+ log_debug ! ( self . logger, "{} channel graph entry for {} due to a payment failure." , action, short_channel_id) ;
266
+ self . channel_failed ( short_channel_id, is_permanent) ;
269
267
} ,
270
268
NetworkUpdate :: NodeFailure { ref node_id, is_permanent } => {
271
269
let action = if is_permanent { "Removing" } else { "Disabling" } ;
272
- log_debug ! ( logger, "{} node graph entry for {} due to a payment failure." , action, node_id) ;
273
- network_graph . node_failed ( node_id, is_permanent) ;
270
+ log_debug ! ( self . logger, "{} node graph entry for {} due to a payment failure." , action, node_id) ;
271
+ self . node_failed ( node_id, is_permanent) ;
274
272
} ,
275
273
}
276
274
}
@@ -984,7 +982,7 @@ impl<L: Deref> Writeable for NetworkGraph<L> where L::Target: Logger {
984
982
}
985
983
986
984
impl < L : Deref > ReadableArgs < L > for NetworkGraph < L > where L :: Target : Logger {
987
- fn read < R : io:: Read > ( reader : & mut R , _logger : L ) -> Result < NetworkGraph < L > , DecodeError > {
985
+ fn read < R : io:: Read > ( reader : & mut R , logger : L ) -> Result < NetworkGraph < L > , DecodeError > {
988
986
let _ver = read_ver_prefix ! ( reader, SERIALIZATION_VERSION ) ;
989
987
990
988
let genesis_hash: BlockHash = Readable :: read ( reader) ?;
@@ -1011,7 +1009,7 @@ impl<L: Deref> ReadableArgs<L> for NetworkGraph<L> where L::Target: Logger {
1011
1009
Ok ( NetworkGraph {
1012
1010
secp_ctx : Secp256k1 :: verification_only ( ) ,
1013
1011
genesis_hash,
1014
- _logger ,
1012
+ logger ,
1015
1013
channels : RwLock :: new ( channels) ,
1016
1014
nodes : RwLock :: new ( nodes) ,
1017
1015
last_rapid_gossip_sync_timestamp : Mutex :: new ( last_rapid_gossip_sync_timestamp) ,
@@ -1043,11 +1041,11 @@ impl<L: Deref> PartialEq for NetworkGraph<L> where L::Target: Logger {
1043
1041
1044
1042
impl < L : Deref > NetworkGraph < L > where L :: Target : Logger {
1045
1043
/// Creates a new, empty, network graph.
1046
- pub fn new ( genesis_hash : BlockHash , _logger : L ) -> NetworkGraph < L > {
1044
+ pub fn new ( genesis_hash : BlockHash , logger : L ) -> NetworkGraph < L > {
1047
1045
Self {
1048
1046
secp_ctx : Secp256k1 :: verification_only ( ) ,
1049
1047
genesis_hash,
1050
- _logger ,
1048
+ logger ,
1051
1049
channels : RwLock :: new ( BTreeMap :: new ( ) ) ,
1052
1050
nodes : RwLock :: new ( BTreeMap :: new ( ) ) ,
1053
1051
last_rapid_gossip_sync_timestamp : Mutex :: new ( None ) ,
0 commit comments