Skip to content

Commit a1a0bc3

Browse files
Score PaymentPathFailed w/o scid as ProbeSuccess
Prior to this commit, we wouldn't score PaymentPathFailed events when the destination explicitly failed the payment back (which causes the blamed scid to be None). Instead, we should treat this as a ProbeSuccess because the payment reached the destination.
1 parent 49b8c15 commit a1a0bc3

File tree

1 file changed

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

1 file changed

+9
-2
lines changed

lightning-background-processor/src/lib.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,17 @@ fn update_scorer<'a, S: 'static + Deref<Target = SC> + Send + Sync, SC: 'a + Wri
225225
scorer: &'a S, event: &Event
226226
) {
227227
match event {
228-
Event::PaymentPathFailed { ref path, short_channel_id: Some(scid), .. } => {
228+
Event::PaymentPathFailed { ref path, short_channel_id, .. } => {
229229
let path = path.iter().collect::<Vec<_>>();
230230
let mut score = scorer.lock();
231-
score.payment_path_failed(&path, *scid);
231+
if let Some(scid) = short_channel_id {
232+
score.payment_path_failed(&path, *scid);
233+
} else {
234+
// `short_channel_id` will be None when the destination explicitly failed it back. We treat
235+
// this as a successful probe because the payment made it all the way to the destination
236+
// with sufficient liquidity.
237+
score.probe_successful(&path);
238+
}
232239
},
233240
Event::PaymentPathSuccessful { path, .. } => {
234241
let path = path.iter().collect::<Vec<_>>();

0 commit comments

Comments
 (0)