Store previously failed blinded paths on outbound payment failure.
[rust-lightning] / lightning / src / routing / router.rs
index 44933d6746748b05f8f668a314e2e7bbed218acd..284bf62f36e561f1f1793e3d302f0d7d54280175 100644 (file)
@@ -914,6 +914,19 @@ impl PaymentParameters {
        pub fn with_max_channel_saturation_power_of_half(self, max_channel_saturation_power_of_half: u8) -> Self {
                Self { max_channel_saturation_power_of_half, ..self }
        }
+
+       pub(crate) fn insert_previously_failed_blinded_path(&mut self, failed_blinded_tail: &BlindedTail) {
+               let mut found_blinded_tail = false;
+               for (idx, (_, path)) in self.payee.blinded_route_hints().iter().enumerate() {
+                       if failed_blinded_tail.hops == path.blinded_hops &&
+                               failed_blinded_tail.blinding_point == path.blinding_point
+                       {
+                               self.previously_failed_blinded_path_idxs.push(idx as u64);
+                               found_blinded_tail = true;
+                       }
+               }
+               debug_assert!(found_blinded_tail);
+       }
 }
 
 /// The recipient of a payment, differing based on whether they've hidden their identity with route