Skip to content

Commit 8da86ed

Browse files
Persist previously failed blinded paths in RouteParameters.
Useful so we don't retry over these paths.
1 parent e25a892 commit 8da86ed

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,11 @@ pub struct PaymentParameters {
711711
/// payment to fail. Future attempts for the same payment shouldn't be relayed through any of
712712
/// these SCIDs.
713713
pub previously_failed_channels: Vec<u64>,
714+
715+
/// A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this
716+
/// payment was previously attempted over and which caused the payment to fail. Future attempts
717+
/// for the same payment shouldn't be relayed through any of these blinded paths.
718+
pub previously_failed_blinded_path_idxs: Vec<u64>,
714719
}
715720

716721
impl Writeable for PaymentParameters {
@@ -750,6 +755,7 @@ impl ReadableArgs<u32> for PaymentParameters {
750755
(7, previously_failed_channels, optional_vec),
751756
(8, blinded_route_hints, optional_vec),
752757
(9, final_cltv_expiry_delta, (default_value, default_final_cltv_expiry_delta)),
758+
(11, previously_failed_blinded_path_idxs, optional_vec),
753759
});
754760
let blinded_route_hints = blinded_route_hints.unwrap_or(vec![]);
755761
let payee = if blinded_route_hints.len() != 0 {
@@ -773,6 +779,7 @@ impl ReadableArgs<u32> for PaymentParameters {
773779
max_channel_saturation_power_of_half: _init_tlv_based_struct_field!(max_channel_saturation_power_of_half, (default_value, unused)),
774780
expiry_time,
775781
previously_failed_channels: previously_failed_channels.unwrap_or(Vec::new()),
782+
previously_failed_blinded_path_idxs: previously_failed_blinded_path_idxs.unwrap_or(Vec::new()),
776783
})
777784
}
778785
}
@@ -791,6 +798,7 @@ impl PaymentParameters {
791798
max_path_count: DEFAULT_MAX_PATH_COUNT,
792799
max_channel_saturation_power_of_half: DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF,
793800
previously_failed_channels: Vec::new(),
801+
previously_failed_blinded_path_idxs: Vec::new(),
794802
}
795803
}
796804

@@ -829,6 +837,7 @@ impl PaymentParameters {
829837
max_path_count: DEFAULT_MAX_PATH_COUNT,
830838
max_channel_saturation_power_of_half: DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF,
831839
previously_failed_channels: Vec::new(),
840+
previously_failed_blinded_path_idxs: Vec::new(),
832841
}
833842
}
834843

0 commit comments

Comments
 (0)