Skip to content

Commit a786d47

Browse files
Score PaymentPathFailed with payment_failed_permanently as ProbeSuccess
Prior to this commit, we wouldn't score PaymentPathFailed events when the destination explicitly failed the payment back when the blamed scid is None. Instead, we should treat this as a ProbeSuccess because the payment reached the destination.
1 parent eb06199 commit a786d47

File tree

1 file changed

+8
-2
lines changed
  • lightning-background-processor/src

1 file changed

+8
-2
lines changed

lightning-background-processor/src/lib.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,15 @@ fn update_scorer<'a, S: 'static + Deref<Target = SC> + Send + Sync, SC: 'a + Wri
226226
) {
227227
let mut score = scorer.lock();
228228
match event {
229-
Event::PaymentPathFailed { ref path, short_channel_id: Some(scid), .. } => {
229+
Event::PaymentPathFailed { ref path, short_channel_id, payment_failed_permanently, .. } => {
230230
let path = path.iter().collect::<Vec<_>>();
231-
score.payment_path_failed(&path, *scid);
231+
if let Some(scid) = short_channel_id {
232+
score.payment_path_failed(&path, *scid);
233+
} else if *payment_failed_permanently {
234+
// Reached if the destination explicitly failed it back. We treat this as a successful probe
235+
// because the payment made it all the way to the destination with sufficient liquidity.
236+
score.probe_successful(&path);
237+
}
232238
},
233239
Event::PaymentPathSuccessful { path, .. } => {
234240
let path = path.iter().collect::<Vec<_>>();

0 commit comments

Comments
 (0)