Skip to content

Commit 1b4c0e8

Browse files
committed
Extend logging of ignored candidates
1 parent aac3d38 commit 1b4c0e8

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

lightning/src/routing/router.rs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,8 @@ where L::Target: Logger {
17101710
let mut num_ignored_cltv_delta_limit = 0;
17111711
let mut num_ignored_previously_failed = 0;
17121712
let mut num_ignored_total_fee_limit = 0;
1713+
let mut num_ignored_avoid_overpayment = 0;
1714+
let mut num_ignored_htlc_minimum_msat_limit = 0;
17131715

17141716
macro_rules! add_entry {
17151717
// Adds entry which goes from $src_node_id to $dest_node_id over the $candidate hop.
@@ -1817,6 +1819,12 @@ where L::Target: Logger {
18171819
}
18181820
num_ignored_previously_failed += 1;
18191821
} else if may_overpay_to_meet_path_minimum_msat {
1822+
if should_log_candidate {
1823+
log_trace!(logger,
1824+
"Ignoring {} to avoid overpaying to meet htlc_minimum_msat limit.",
1825+
LoggedCandidateHop(&$candidate));
1826+
}
1827+
num_ignored_avoid_overpayment += 1;
18201828
hit_minimum_limit = true;
18211829
} else if over_path_minimum_msat {
18221830
// Note that low contribution here (limited by available_liquidity_msat)
@@ -1966,6 +1974,13 @@ where L::Target: Logger {
19661974
}
19671975
}
19681976
}
1977+
} else {
1978+
if should_log_candidate {
1979+
log_trace!(logger,
1980+
"Ignoring {} due to its htlc_minimum_msat limit.",
1981+
LoggedCandidateHop(&$candidate));
1982+
}
1983+
num_ignored_htlc_minimum_msat_limit += 1;
19691984
}
19701985
}
19711986
}
@@ -2428,15 +2443,22 @@ where L::Target: Logger {
24282443
log_trace!(logger, "Collected exactly our payment amount on the first pass, without hitting an htlc_minimum_msat limit, exiting.");
24292444
break 'paths_collection;
24302445
}
2431-
log_trace!(logger, "Collected our payment amount on the first pass, but running again to collect extra paths with a potentially higher limit.");
2446+
log_trace!(logger, "Collected our payment amount on the first pass, but running again to collect extra paths with a potentially higher value to meet htlc_minimum_msat limit.");
24322447
path_value_msat = recommended_value_msat;
24332448
}
24342449
}
24352450

24362451
let num_ignored_total = num_ignored_value_contribution + num_ignored_path_length_limit +
2437-
num_ignored_cltv_delta_limit + num_ignored_previously_failed + num_ignored_total_fee_limit;
2452+
num_ignored_cltv_delta_limit + num_ignored_previously_failed +
2453+
num_ignored_avoid_overpayment + num_ignored_htlc_minimum_msat_limit +
2454+
num_ignored_total_fee_limit;
24382455
if num_ignored_total > 0 {
2439-
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, {} due to maximum total fee limit. Total: {} ignored candidates.", num_ignored_value_contribution, num_ignored_path_length_limit, num_ignored_cltv_delta_limit, num_ignored_previously_failed, num_ignored_total_fee_limit, num_ignored_total);
2456+
log_trace!(logger,
2457+
"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, {} to avoid overpaying, {} due to maximum total fee limit. Total: {} ignored candidates.",
2458+
num_ignored_value_contribution, num_ignored_path_length_limit,
2459+
num_ignored_cltv_delta_limit, num_ignored_previously_failed,
2460+
num_ignored_htlc_minimum_msat_limit, num_ignored_avoid_overpayment,
2461+
num_ignored_total_fee_limit, num_ignored_total);
24402462
}
24412463

24422464
// Step (5).

0 commit comments

Comments
 (0)