@@ -218,12 +218,6 @@ pub struct ReadOnlyNetworkGraph<'a> {
218
218
/// [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
219
219
#[ derive( Clone , Debug , PartialEq , Eq ) ]
220
220
pub enum NetworkUpdate {
221
- /// An error indicating a `channel_update` messages should be applied via
222
- /// [`NetworkGraph::update_channel`].
223
- ChannelUpdateMessage {
224
- /// The update to apply via [`NetworkGraph::update_channel`].
225
- msg : ChannelUpdate ,
226
- } ,
227
221
/// An error indicating that a channel failed to route a payment, which should be applied via
228
222
/// [`NetworkGraph::channel_failed_permanent`] if permanent.
229
223
ChannelFailure {
@@ -245,9 +239,7 @@ pub enum NetworkUpdate {
245
239
}
246
240
247
241
impl_writeable_tlv_based_enum_upgradable ! ( NetworkUpdate ,
248
- ( 0 , ChannelUpdateMessage ) => {
249
- ( 0 , msg, required) ,
250
- } ,
242
+ // 0 was used for channel updates in LDK versions 0.0.123 and below.
251
243
( 2 , ChannelFailure ) => {
252
244
( 0 , short_channel_id, required) ,
253
245
( 2 , is_permanent, required) ,
@@ -354,18 +346,9 @@ where U::Target: UtxoLookup, L::Target: Logger
354
346
impl < L : Deref > NetworkGraph < L > where L :: Target : Logger {
355
347
/// Handles any network updates originating from [`Event`]s.
356
348
//
357
- /// Note that this will skip applying any [`NetworkUpdate::ChannelUpdateMessage`] to avoid
358
- /// leaking possibly identifying information of the sender to the public network.
359
- ///
360
349
/// [`Event`]: crate::events::Event
361
350
pub fn handle_network_update ( & self , network_update : & NetworkUpdate ) {
362
351
match * network_update {
363
- NetworkUpdate :: ChannelUpdateMessage { ref msg } => {
364
- let short_channel_id = msg. contents . short_channel_id ;
365
- let is_enabled = msg. contents . flags & ( 1 << 1 ) != ( 1 << 1 ) ;
366
- let status = if is_enabled { "enabled" } else { "disabled" } ;
367
- log_debug ! ( self . logger, "Skipping application of a channel update from a payment failure. Channel {} is {}." , short_channel_id, status) ;
368
- } ,
369
352
NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent } => {
370
353
if is_permanent {
371
354
log_debug ! ( self . logger, "Removing channel graph entry for {} due to a payment failure." , short_channel_id) ;
@@ -2575,23 +2558,18 @@ pub(crate) mod tests {
2575
2558
2576
2559
let short_channel_id;
2577
2560
{
2578
- // Check we won't apply an update via `handle_network_update` for privacy reasons, but
2579
- // can continue fine if we manually apply it.
2561
+ // Check that we can manually apply a channel update.
2580
2562
let valid_channel_announcement = get_signed_channel_announcement ( |_| { } , node_1_privkey, node_2_privkey, & secp_ctx) ;
2581
2563
short_channel_id = valid_channel_announcement. contents . short_channel_id ;
2582
2564
let chain_source: Option < & test_utils:: TestChainSource > = None ;
2583
2565
assert ! ( network_graph. update_channel_from_announcement( & valid_channel_announcement, & chain_source) . is_ok( ) ) ;
2584
2566
assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . is_some( ) ) ;
2585
2567
2586
2568
let valid_channel_update = get_signed_channel_update ( |_| { } , node_1_privkey, & secp_ctx) ;
2587
- assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_none( ) ) ;
2588
-
2589
- network_graph. handle_network_update ( & NetworkUpdate :: ChannelUpdateMessage {
2590
- msg : valid_channel_update. clone ( ) ,
2591
- } ) ;
2592
2569
2593
2570
assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_none( ) ) ;
2594
2571
network_graph. update_channel ( & valid_channel_update) . unwrap ( ) ;
2572
+ assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_some( ) ) ;
2595
2573
}
2596
2574
2597
2575
// Non-permanent failure doesn't touch the channel at all
0 commit comments