Skip to content

Commit ae1288d

Browse files
Add failed_within_blinded_path to onion util internal struct.
Will be used to ensure correctness when we store previously failed blinded paths to avoid retrying over them.
1 parent 0d513fd commit ae1288d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
463463
network_update: Option<NetworkUpdate>,
464464
short_channel_id: Option<u64>,
465465
payment_failed_permanently: bool,
466+
failed_within_blinded_path: bool,
466467
}
467468
let mut res: Option<FailureLearnings> = None;
468469
let mut htlc_msat = *first_hop_htlc_msat;
@@ -488,7 +489,8 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
488489
error_code_ret = Some(BADONION | PERM | 24); // invalid_onion_blinding
489490
error_packet_ret = Some(vec![0; 32]);
490491
res = Some(FailureLearnings {
491-
network_update: None, short_channel_id: None, payment_failed_permanently: false
492+
network_update: None, short_channel_id: None, payment_failed_permanently: false,
493+
failed_within_blinded_path: true,
492494
});
493495
return
494496
},
@@ -520,7 +522,8 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
520522
}
521523

522524
res = Some(FailureLearnings {
523-
network_update: None, short_channel_id: None, payment_failed_permanently: false
525+
network_update: None, short_channel_id: None, payment_failed_permanently: false,
526+
failed_within_blinded_path: true,
524527
});
525528
return
526529
}
@@ -550,7 +553,8 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
550553
});
551554
let short_channel_id = Some(route_hop.short_channel_id);
552555
res = Some(FailureLearnings {
553-
network_update, short_channel_id, payment_failed_permanently: is_from_final_node
556+
network_update, short_channel_id, payment_failed_permanently: is_from_final_node,
557+
failed_within_blinded_path: false
554558
});
555559
return
556560
}
@@ -706,7 +710,8 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
706710

707711
res = Some(FailureLearnings {
708712
network_update, short_channel_id,
709-
payment_failed_permanently: error_code & PERM == PERM && is_from_final_node
713+
payment_failed_permanently: error_code & PERM == PERM && is_from_final_node,
714+
failed_within_blinded_path: false
710715
});
711716

712717
let (description, title) = errors::get_onion_error_description(error_code);
@@ -717,7 +722,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
717722
}
718723
}).expect("Route that we sent via spontaneously grew invalid keys in the middle of it?");
719724
if let Some(FailureLearnings {
720-
network_update, short_channel_id, payment_failed_permanently
725+
network_update, short_channel_id, payment_failed_permanently, failed_within_blinded_path
721726
}) = res {
722727
DecodedOnionFailure {
723728
network_update, short_channel_id, payment_failed_permanently,

0 commit comments

Comments
 (0)