Skip to content

Commit dc97ae8

Browse files
committed
Extend logging of ignored candidates
1 parent 10cc0f5 commit dc97ae8

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

lightning/src/routing/router.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,8 @@ where L::Target: Logger {
16881688
let mut num_ignored_path_length_limit = 0;
16891689
let mut num_ignored_cltv_delta_limit = 0;
16901690
let mut num_ignored_previously_failed = 0;
1691+
let mut num_ignored_first_pass_may_overpay = 0;
1692+
let mut num_ignored_htlc_minimum_msat_limit = 0;
16911693

16921694
macro_rules! add_entry {
16931695
// Adds entry which goes from $src_node_id to $dest_node_id over the $candidate hop.
@@ -1795,6 +1797,12 @@ where L::Target: Logger {
17951797
}
17961798
num_ignored_previously_failed += 1;
17971799
} else if may_overpay_to_meet_path_minimum_msat {
1800+
if should_log_candidate {
1801+
log_trace!(logger,
1802+
"Ignoring {} on the first pass to avoid overpaying to meet htlc_minimum_msat limit.",
1803+
LoggedCandidateHop(&$candidate));
1804+
}
1805+
num_ignored_first_pass_may_overpay += 1;
17981806
hit_minimum_limit = true;
17991807
} else if over_path_minimum_msat {
18001808
// Note that low contribution here (limited by available_liquidity_msat)
@@ -1935,6 +1943,13 @@ where L::Target: Logger {
19351943
}
19361944
}
19371945
}
1946+
} else {
1947+
if should_log_candidate {
1948+
log_trace!(logger,
1949+
"Ignoring {} due to its htlc_minimum_msat limit.",
1950+
LoggedCandidateHop(&$candidate));
1951+
}
1952+
num_ignored_htlc_minimum_msat_limit += 1;
19381953
}
19391954
}
19401955
}
@@ -2403,9 +2418,15 @@ where L::Target: Logger {
24032418
}
24042419

24052420
let num_ignored_total = num_ignored_value_contribution + num_ignored_path_length_limit +
2406-
num_ignored_cltv_delta_limit + num_ignored_previously_failed;
2421+
num_ignored_cltv_delta_limit + num_ignored_previously_failed +
2422+
num_ignored_first_pass_may_overpay + num_ignored_htlc_minimum_msat_limit;
24072423
if num_ignored_total > 0 {
2408-
log_trace!(logger, "Ignored {} candidate hops due to insufficient value contribution, {} due to path length limit, {} due to CLTV delta limit, {} due to previous payment failure. Total: {} ignored candidates.", num_ignored_value_contribution, num_ignored_path_length_limit, num_ignored_cltv_delta_limit, num_ignored_previously_failed, num_ignored_total);
2424+
log_trace!(logger,
2425+
"Ignored {} candidate hops due to insufficient value contribution, {} due to path length limit, {} due to CLTV delta limit, {} due to previous payment failure, {} due to htlc_minimum_msat limit, {} on first pass to avoid overpaying. Total: {} ignored candidates.",
2426+
num_ignored_value_contribution, num_ignored_path_length_limit,
2427+
num_ignored_cltv_delta_limit, num_ignored_previously_failed,
2428+
num_ignored_htlc_minimum_msat_limit, num_ignored_first_pass_may_overpay,
2429+
num_ignored_total);
24092430
}
24102431

24112432
// Step (5).

0 commit comments

Comments
 (0)