Skip to content

Commit 1364ae1

Browse files
committed
f - s/fail_channel_update/network_update in onion_utils.rs
1 parent ca1224d commit 1364ae1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,13 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(secp_ctx: &
383383
} && is_from_final_node) // PERM bit observed below even this error is from the intermediate nodes
384384
|| error_code == 21; // Special case error 21 as the Route object is bogus, TODO: Maybe fail the node if the CLTV was reasonable?
385385

386-
let mut fail_channel_update = None;
386+
let mut network_update = None;
387387

388388
if error_code & NODE == NODE {
389-
fail_channel_update = Some(NetworkUpdate::NodeFailure { node_id: route_hop.pubkey, is_permanent: error_code & PERM == PERM });
389+
network_update = Some(NetworkUpdate::NodeFailure { node_id: route_hop.pubkey, is_permanent: error_code & PERM == PERM });
390390
}
391391
else if error_code & PERM == PERM {
392-
fail_channel_update = if payment_failed { None } else { Some(NetworkUpdate::ChannelClosed {
392+
network_update = if payment_failed { None } else { Some(NetworkUpdate::ChannelClosed {
393393
short_channel_id: path[next_route_hop_ix - if next_route_hop_ix == path.len() { 1 } else { 0 }].short_channel_id,
394394
is_permanent: true,
395395
})};
@@ -413,7 +413,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(secp_ctx: &
413413
20 => chan_update.contents.flags & 2 == 0,
414414
_ => false, // unknown error code; take channel_update as valid
415415
};
416-
fail_channel_update = if is_chan_update_invalid {
416+
network_update = if is_chan_update_invalid {
417417
// This probably indicates the node which forwarded
418418
// to the node in question corrupted something.
419419
Some(NetworkUpdate::ChannelClosed {
@@ -428,10 +428,10 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(secp_ctx: &
428428
}
429429
}
430430
}
431-
if fail_channel_update.is_none() {
431+
if network_update.is_none() {
432432
// They provided an UPDATE which was obviously bogus, not worth
433433
// trying to relay through them anymore.
434-
fail_channel_update = Some(NetworkUpdate::NodeFailure {
434+
network_update = Some(NetworkUpdate::NodeFailure {
435435
node_id: route_hop.pubkey,
436436
is_permanent: true,
437437
});
@@ -440,7 +440,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(secp_ctx: &
440440
// We can't understand their error messages and they failed to
441441
// forward...they probably can't understand our forwards so its
442442
// really not worth trying any further.
443-
fail_channel_update = Some(NetworkUpdate::NodeFailure {
443+
network_update = Some(NetworkUpdate::NodeFailure {
444444
node_id: route_hop.pubkey,
445445
is_permanent: true,
446446
});
@@ -449,7 +449,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(secp_ctx: &
449449
// TODO: Here (and a few other places) we assume that BADONION errors
450450
// are always "sourced" from the node previous to the one which failed
451451
// to decode the onion.
452-
res = Some((fail_channel_update, !(error_code & PERM == PERM && is_from_final_node)));
452+
res = Some((network_update, !(error_code & PERM == PERM && is_from_final_node)));
453453

454454
let (description, title) = errors::get_onion_error_description(error_code);
455455
if debug_field_size > 0 && err_packet.failuremsg.len() >= 4 + debug_field_size {

0 commit comments

Comments
 (0)