Skip to content

Commit 6144e30

Browse files
Wrap process_onion_failure comments at 100chars
And fix an its vs it's grammar
1 parent 9f5e574 commit 6144e30

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ where L::Target: Logger {
415415
chacha.process(&packet_decrypted, &mut decryption_tmp[..]);
416416
packet_decrypted = decryption_tmp;
417417

418-
// The failing hop includes either the inbound channel to the recipient or the outbound
419-
// channel from the current hop (i.e., the next hop's inbound channel).
418+
// The failing hop includes either the inbound channel to the recipient or the outbound channel
419+
// from the current hop (i.e., the next hop's inbound channel).
420420
is_from_final_node = route_hop_idx + 1 == path.hops.len();
421421
let failing_route_hop = if is_from_final_node { route_hop } else { &path.hops[route_hop_idx + 1] };
422422

@@ -432,8 +432,8 @@ where L::Target: Logger {
432432
let error_code_slice = match err_packet.failuremsg.get(0..2) {
433433
Some(s) => s,
434434
None => {
435-
// Useless packet that we can't use but it passed HMAC, so it
436-
// definitely came from the peer in question
435+
// Useless packet that we can't use but it passed HMAC, so it definitely came from the peer
436+
// in question
437437
let network_update = Some(NetworkUpdate::NodeFailure {
438438
node_id: route_hop.pubkey,
439439
is_permanent: true,
@@ -454,8 +454,7 @@ where L::Target: Logger {
454454

455455
let (debug_field, debug_field_size) = errors::get_onion_debug_field(error_code);
456456

457-
// indicate that payment parameter has failed and no need to
458-
// update Route object
457+
// indicate that payment parameter has failed and no need to update Route object
459458
let payment_failed = match error_code & 0xff {
460459
15|16|17|18|19|23 => true,
461460
_ => false,
@@ -465,14 +464,13 @@ where L::Target: Logger {
465464
let mut short_channel_id = None;
466465

467466
if error_code & BADONION == BADONION {
468-
// If the error code has the BADONION bit set, always blame the channel
469-
// from the node "originating" the error to its next hop. The
470-
// "originator" is ultimately actually claiming that its counterparty
471-
// is the one who is failing the HTLC.
472-
// If the "originator" here isn't lying we should really mark the
473-
// next-hop node as failed entirely, but we can't be confident in that,
474-
// as it would allow any node to get us to completely ban one of its
475-
// counterparties. Instead, we simply remove the channel in question.
467+
// If the error code has the BADONION bit set, always blame the channel from the node
468+
// "originating" the error to its next hop. The "originator" is ultimately actually claiming
469+
// that its counterparty is the one who is failing the HTLC.
470+
// If the "originator" here isn't lying we should really mark the next-hop node as failed
471+
// entirely, but we can't be confident in that, as it would allow any node to get us to
472+
// completely ban one of its counterparties. Instead, we simply remove the channel in
473+
// question.
476474
network_update = Some(NetworkUpdate::ChannelFailure {
477475
short_channel_id: failing_route_hop.short_channel_id,
478476
is_permanent: true,
@@ -579,16 +577,15 @@ where L::Target: Logger {
579577
short_channel_id = Some(route_hop.short_channel_id);
580578
}
581579
} else if payment_failed {
582-
// Only blame the hop when a value in the HTLC doesn't match the
583-
// corresponding value in the onion.
580+
// Only blame the hop when a value in the HTLC doesn't match the corresponding value in the
581+
// onion.
584582
short_channel_id = match error_code & 0xff {
585583
18|19 => Some(route_hop.short_channel_id),
586584
_ => None,
587585
};
588586
} else {
589-
// We can't understand their error messages and they failed to
590-
// forward...they probably can't understand our forwards so its
591-
// really not worth trying any further.
587+
// We can't understand their error messages and they failed to forward...they probably can't
588+
// understand our forwards so it's really not worth trying any further.
592589
network_update = Some(NetworkUpdate::NodeFailure {
593590
node_id: route_hop.pubkey,
594591
is_permanent: true,

0 commit comments

Comments
 (0)