Skip to content

Commit 75a1c47

Browse files
Add failed_within_blinded_path to DecodedOnionFailure.
Will be used to ensure correctness when we store previously failed blinded paths to avoid retrying over them.
1 parent ae1288d commit 75a1c47

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ pub(crate) struct DecodedOnionFailure {
429429
pub(crate) network_update: Option<NetworkUpdate>,
430430
pub(crate) short_channel_id: Option<u64>,
431431
pub(crate) payment_failed_permanently: bool,
432+
pub(crate) failed_within_blinded_path: bool,
432433
#[cfg(test)]
433434
pub(crate) onion_error_code: Option<u16>,
434435
#[cfg(test)]
@@ -725,7 +726,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
725726
network_update, short_channel_id, payment_failed_permanently, failed_within_blinded_path
726727
}) = res {
727728
DecodedOnionFailure {
728-
network_update, short_channel_id, payment_failed_permanently,
729+
network_update, short_channel_id, payment_failed_permanently, failed_within_blinded_path,
729730
#[cfg(test)]
730731
onion_error_code: error_code_ret,
731732
#[cfg(test)]
@@ -736,6 +737,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
736737
// payment not retryable only when garbage is from the final node
737738
DecodedOnionFailure {
738739
network_update: None, short_channel_id: None, payment_failed_permanently: is_from_final_node,
740+
failed_within_blinded_path: false,
739741
#[cfg(test)]
740742
onion_error_code: None,
741743
#[cfg(test)]
@@ -883,6 +885,7 @@ impl HTLCFailReason {
883885
network_update: None,
884886
payment_failed_permanently: false,
885887
short_channel_id: Some(path.hops[0].short_channel_id),
888+
failed_within_blinded_path: false,
886889
#[cfg(test)]
887890
onion_error_code: Some(*failure_code),
888891
#[cfg(test)]

lightning/src/ln/outbound_payment.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl PendingOutboundPayment {
243243
if insert_res {
244244
if let PendingOutboundPayment::Retryable {
245245
ref mut pending_amt_msat, ref mut pending_fee_msat,
246-
ref mut remaining_max_total_routing_fee_msat, ..
246+
ref mut remaining_max_total_routing_fee_msat, ..
247247
} = self {
248248
*pending_amt_msat += path.final_value_msat();
249249
let path_fee_msat = path.fee_msat();
@@ -1604,11 +1604,12 @@ impl OutboundPayments {
16041604
#[cfg(test)]
16051605
let DecodedOnionFailure {
16061606
network_update, short_channel_id, payment_failed_permanently, onion_error_code,
1607-
onion_error_data
1607+
onion_error_data, failed_within_blinded_path
16081608
} = onion_error.decode_onion_failure(secp_ctx, logger, &source);
16091609
#[cfg(not(test))]
1610-
let DecodedOnionFailure { network_update, short_channel_id, payment_failed_permanently } =
1611-
onion_error.decode_onion_failure(secp_ctx, logger, &source);
1610+
let DecodedOnionFailure {
1611+
network_update, short_channel_id, payment_failed_permanently, failed_within_blinded_path
1612+
} = onion_error.decode_onion_failure(secp_ctx, logger, &source);
16121613

16131614
let payment_is_probe = payment_is_probe(payment_hash, &payment_id, probing_cookie_secret);
16141615
let mut session_priv_bytes = [0; 32];

0 commit comments

Comments
 (0)