1
+ #include "bitcoin/short_channel_id.h"
1
2
#include "config.h"
2
3
#include <ccan/array_size/array_size.h>
3
4
#include <ccan/tal/str/str.h>
@@ -402,15 +403,29 @@ static void payment_exclude_most_expensive(struct payment *p)
402
403
struct route_hop * e = & p -> route [0 ];
403
404
struct amount_msat fee , worst = AMOUNT_MSAT (0 );
404
405
405
- for (size_t i = 0 ; i < tal_count (p -> route )- 1 ; i ++ ) {
406
+ paymod_log (p , LOG_DBG ,
407
+ "Searching for most expensive channel to exclude in route" );
408
+ for (size_t i = 0 ; i < tal_count (p -> route ) - 1 ; i ++ ) {
406
409
if (!amount_msat_sub (& fee , p -> route [i ].amount , p -> route [i + 1 ].amount ))
407
410
paymod_err (p , "Negative fee in a route." );
408
411
409
412
if (amount_msat_greater_eq (fee , worst )) {
413
+ paymod_log (
414
+ p , LOG_DBG , "Found worse channel: %s >= %s (%s/%d)" ,
415
+ type_to_string (tmpctx , struct amount_msat , & fee ),
416
+ type_to_string (tmpctx , struct amount_msat , & worst ),
417
+ type_to_string (tmpctx , struct short_channel_id ,
418
+ & p -> route [i ].scid ),
419
+ p -> route [i ].direction );
410
420
e = & p -> route [i ];
411
421
worst = fee ;
412
422
}
413
423
}
424
+ paymod_log (p , LOG_DBG ,
425
+ "Excluding %s/%d as the most expensive channel in the route" ,
426
+ type_to_string (tmpctx , struct short_channel_id , & e -> scid ),
427
+ e -> direction );
428
+
414
429
channel_hints_update (p , e -> scid , e -> direction , false, false,
415
430
NULL , NULL );
416
431
}
@@ -420,15 +435,29 @@ static void payment_exclude_longest_delay(struct payment *p)
420
435
struct route_hop * e = & p -> route [0 ];
421
436
u32 delay , worst = 0 ;
422
437
423
- for (size_t i = 0 ; i < tal_count (p -> route )- 1 ; i ++ ) {
438
+ paymod_log (p , LOG_DBG ,
439
+ "Searching for longest delay channel to exclude in route" );
440
+ for (size_t i = 0 ; i < tal_count (p -> route ) - 1 ; i ++ ) {
424
441
delay = p -> route [i ].delay - p -> route [i + 1 ].delay ;
425
442
if (delay >= worst ) {
443
+ paymod_log (
444
+ p , LOG_DBG , "Found worse channel: %d >= %d (%s/%d)" ,
445
+ delay , worst ,
446
+ type_to_string (tmpctx , struct short_channel_id ,
447
+ & p -> route [i ].scid ),
448
+ p -> route [i ].direction );
426
449
e = & p -> route [i ];
427
450
worst = delay ;
428
451
}
429
452
}
430
- channel_hints_update (p , e -> scid , e -> direction , false, false,
431
- NULL , NULL );
453
+
454
+ paymod_log (p , LOG_DBG ,
455
+ "Excluding %s/%d as the most expensive channel in the route" ,
456
+ type_to_string (tmpctx , struct short_channel_id , & e -> scid ),
457
+ e -> direction );
458
+
459
+ channel_hints_update (p , e -> scid , e -> direction , false, false, NULL ,
460
+ NULL );
432
461
}
433
462
434
463
static struct amount_msat payment_route_fee (struct payment * p )
0 commit comments