@@ -341,6 +341,9 @@ where U::Target: UtxoLookup, L::Target: Logger
341
341
342
342
impl < L : Deref > NetworkGraph < L > where L :: Target : Logger {
343
343
/// Handles any network updates originating from [`Event`]s.
344
+ //
345
+ /// Note that this will skip applying any [`NetworkUpdate::ChannelUpdateMessage`] to avoid
346
+ /// leaking possibly identifying information of the sender to the public network.
344
347
///
345
348
/// [`Event`]: crate::events::Event
346
349
pub fn handle_network_update ( & self , network_update : & NetworkUpdate ) {
@@ -349,8 +352,7 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
349
352
let short_channel_id = msg. contents . short_channel_id ;
350
353
let is_enabled = msg. contents . flags & ( 1 << 1 ) != ( 1 << 1 ) ;
351
354
let status = if is_enabled { "enabled" } else { "disabled" } ;
352
- log_debug ! ( self . logger, "Updating channel with channel_update from a payment failure. Channel {} is {}." , short_channel_id, status) ;
353
- let _ = self . update_channel ( msg) ;
355
+ log_debug ! ( self . logger, "Skipping application of a channel update from a payment failure. Channel {} is {}." , short_channel_id, status) ;
354
356
} ,
355
357
NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent } => {
356
358
if is_permanent {
@@ -2531,7 +2533,8 @@ pub(crate) mod tests {
2531
2533
2532
2534
let short_channel_id;
2533
2535
{
2534
- // Announce a channel we will update
2536
+ // Check we won't apply an update via `handle_network_update` for privacy reasons, but
2537
+ // can continue fine if we manually apply it.
2535
2538
let valid_channel_announcement = get_signed_channel_announcement ( |_| { } , node_1_privkey, node_2_privkey, & secp_ctx) ;
2536
2539
short_channel_id = valid_channel_announcement. contents . short_channel_id ;
2537
2540
let chain_source: Option < & test_utils:: TestChainSource > = None ;
@@ -2542,10 +2545,11 @@ pub(crate) mod tests {
2542
2545
assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_none( ) ) ;
2543
2546
2544
2547
network_graph. handle_network_update ( & NetworkUpdate :: ChannelUpdateMessage {
2545
- msg : valid_channel_update,
2548
+ msg : valid_channel_update. clone ( ) ,
2546
2549
} ) ;
2547
2550
2548
- assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_some( ) ) ;
2551
+ assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_none( ) ) ;
2552
+ network_graph. update_channel ( & valid_channel_update) . unwrap ( ) ;
2549
2553
}
2550
2554
2551
2555
// Non-permanent failure doesn't touch the channel at all
0 commit comments