Skip to content

Commit 590262d

Browse files
Remove now-unused NetworkUpdate::ChannelUpdateMessage.
See previous commit.
1 parent 24c2468 commit 590262d

File tree

3 files changed

+3
-37
lines changed

3 files changed

+3
-37
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,13 +2453,6 @@ pub fn expect_payment_failed_conditions_event<'a, 'b, 'c, 'd, 'e>(
24532453
if let Some(chan_closed) = conditions.expected_blamed_chan_closed {
24542454
if let PathFailure::OnPath { network_update: Some(upd) } = failure {
24552455
match upd {
2456-
NetworkUpdate::ChannelUpdateMessage { ref msg } if !chan_closed => {
2457-
if let Some(scid) = conditions.expected_blamed_scid {
2458-
assert_eq!(msg.contents.short_channel_id, scid);
2459-
}
2460-
const CHAN_DISABLED_FLAG: u8 = 2;
2461-
assert_eq!(msg.contents.flags & CHAN_DISABLED_FLAG, 0);
2462-
},
24632456
NetworkUpdate::ChannelFailure { short_channel_id, is_permanent } => {
24642457
if let Some(scid) = conditions.expected_blamed_scid {
24652458
assert_eq!(*short_channel_id, scid);

lightning/src/ln/onion_route_tests.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,6 @@ fn run_onion_failure_test_with_fail_intercept<F1,F2,F3>(
180180
if expected_channel_update.is_some() {
181181
match network_update {
182182
Some(update) => match update {
183-
&NetworkUpdate::ChannelUpdateMessage { .. } => {
184-
if let NetworkUpdate::ChannelUpdateMessage { .. } = expected_channel_update.unwrap() {} else {
185-
panic!("channel_update not found!");
186-
}
187-
},
188183
&NetworkUpdate::ChannelFailure { ref short_channel_id, ref is_permanent } => {
189184
if let NetworkUpdate::ChannelFailure { short_channel_id: ref expected_short_channel_id, is_permanent: ref expected_is_permanent } = expected_channel_update.unwrap() {
190185
assert!(*short_channel_id == *expected_short_channel_id);

lightning/src/routing/gossip.rs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,6 @@ pub struct ReadOnlyNetworkGraph<'a> {
218218
/// [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
219219
#[derive(Clone, Debug, PartialEq, Eq)]
220220
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-
},
227221
/// An error indicating that a channel failed to route a payment, which should be applied via
228222
/// [`NetworkGraph::channel_failed_permanent`] if permanent.
229223
ChannelFailure {
@@ -245,9 +239,7 @@ pub enum NetworkUpdate {
245239
}
246240

247241
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.
251243
(2, ChannelFailure) => {
252244
(0, short_channel_id, required),
253245
(2, is_permanent, required),
@@ -354,18 +346,9 @@ where U::Target: UtxoLookup, L::Target: Logger
354346
impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
355347
/// Handles any network updates originating from [`Event`]s.
356348
//
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-
///
360349
/// [`Event`]: crate::events::Event
361350
pub fn handle_network_update(&self, network_update: &NetworkUpdate) {
362351
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-
},
369352
NetworkUpdate::ChannelFailure { short_channel_id, is_permanent } => {
370353
if is_permanent {
371354
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 {
25752558

25762559
let short_channel_id;
25772560
{
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.
25802562
let valid_channel_announcement = get_signed_channel_announcement(|_| {}, node_1_privkey, node_2_privkey, &secp_ctx);
25812563
short_channel_id = valid_channel_announcement.contents.short_channel_id;
25822564
let chain_source: Option<&test_utils::TestChainSource> = None;
25832565
assert!(network_graph.update_channel_from_announcement(&valid_channel_announcement, &chain_source).is_ok());
25842566
assert!(network_graph.read_only().channels().get(&short_channel_id).is_some());
25852567

25862568
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-
});
25922569

25932570
assert!(network_graph.read_only().channels().get(&short_channel_id).unwrap().one_to_two.is_none());
25942571
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());
25952573
}
25962574

25972575
// Non-permanent failure doesn't touch the channel at all

0 commit comments

Comments
 (0)