Skip to content

Commit 5c5d691

Browse files
Persist previously failed blinded paths in RouteParameters.
Useful so we don't retry over these paths.
1 parent 75a1c47 commit 5c5d691

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 10 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 {
@@ -732,6 +737,7 @@ impl Writeable for PaymentParameters {
732737
(7, self.previously_failed_channels, required_vec),
733738
(8, *blinded_hints, optional_vec),
734739
(9, self.payee.final_cltv_expiry_delta(), option),
740+
(11, self.previously_failed_blinded_path_idxs, required_vec),
735741
});
736742
Ok(())
737743
}
@@ -750,6 +756,7 @@ impl ReadableArgs<u32> for PaymentParameters {
750756
(7, previously_failed_channels, optional_vec),
751757
(8, blinded_route_hints, optional_vec),
752758
(9, final_cltv_expiry_delta, (default_value, default_final_cltv_expiry_delta)),
759+
(11, previously_failed_blinded_path_idxs, optional_vec),
753760
});
754761
let blinded_route_hints = blinded_route_hints.unwrap_or(vec![]);
755762
let payee = if blinded_route_hints.len() != 0 {
@@ -773,6 +780,7 @@ impl ReadableArgs<u32> for PaymentParameters {
773780
max_channel_saturation_power_of_half: _init_tlv_based_struct_field!(max_channel_saturation_power_of_half, (default_value, unused)),
774781
expiry_time,
775782
previously_failed_channels: previously_failed_channels.unwrap_or(Vec::new()),
783+
previously_failed_blinded_path_idxs: previously_failed_blinded_path_idxs.unwrap_or(Vec::new()),
776784
})
777785
}
778786
}
@@ -791,6 +799,7 @@ impl PaymentParameters {
791799
max_path_count: DEFAULT_MAX_PATH_COUNT,
792800
max_channel_saturation_power_of_half: DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF,
793801
previously_failed_channels: Vec::new(),
802+
previously_failed_blinded_path_idxs: Vec::new(),
794803
}
795804
}
796805

@@ -829,6 +838,7 @@ impl PaymentParameters {
829838
max_path_count: DEFAULT_MAX_PATH_COUNT,
830839
max_channel_saturation_power_of_half: DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF,
831840
previously_failed_channels: Vec::new(),
841+
previously_failed_blinded_path_idxs: Vec::new(),
832842
}
833843
}
834844

0 commit comments

Comments
 (0)