Skip to content

Commit a8eef29

Browse files
committed
Extend logging of ignored candidates
1 parent 391da3f commit a8eef29

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
@@ -1718,6 +1718,8 @@ where L::Target: Logger {
17181718
let mut num_ignored_cltv_delta_limit = 0;
17191719
let mut num_ignored_previously_failed = 0;
17201720
let mut num_ignored_total_fee_limit = 0;
1721+
let mut num_ignored_avoid_overpayment = 0;
1722+
let mut num_ignored_htlc_minimum_msat_limit = 0;
17211723

17221724
macro_rules! add_entry {
17231725
// Adds entry which goes from $src_node_id to $dest_node_id over the $candidate hop.
@@ -1826,6 +1828,12 @@ where L::Target: Logger {
18261828
}
18271829
num_ignored_previously_failed += 1;
18281830
} else if may_overpay_to_meet_path_minimum_msat {
1831+
if should_log_candidate {
1832+
log_trace!(logger,
1833+
"Ignoring {} to avoid overpaying to meet htlc_minimum_msat limit.",
1834+
LoggedCandidateHop(&$candidate));
1835+
}
1836+
num_ignored_avoid_overpayment += 1;
18291837
hit_minimum_limit = true;
18301838
} else if over_path_minimum_msat {
18311839
// Note that low contribution here (limited by available_liquidity_msat)
@@ -1976,6 +1984,13 @@ where L::Target: Logger {
19761984
}
19771985
}
19781986
}
1987+
} else {
1988+
if should_log_candidate {
1989+
log_trace!(logger,
1990+
"Ignoring {} due to its htlc_minimum_msat limit.",
1991+
LoggedCandidateHop(&$candidate));
1992+
}
1993+
num_ignored_htlc_minimum_msat_limit += 1;
19791994
}
19801995
}
19811996
}
@@ -2443,15 +2458,22 @@ where L::Target: Logger {
24432458
log_trace!(logger, "Collected exactly our payment amount on the first pass, without hitting an htlc_minimum_msat limit, exiting.");
24442459
break 'paths_collection;
24452460
}
2446-
log_trace!(logger, "Collected our payment amount on the first pass, but running again to collect extra paths with a potentially higher limit.");
2461+
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.");
24472462
path_value_msat = recommended_value_msat;
24482463
}
24492464
}
24502465

24512466
let num_ignored_total = num_ignored_value_contribution + num_ignored_path_length_limit +
2452-
num_ignored_cltv_delta_limit + num_ignored_previously_failed + num_ignored_total_fee_limit;
2467+
num_ignored_cltv_delta_limit + num_ignored_previously_failed +
2468+
num_ignored_avoid_overpayment + num_ignored_htlc_minimum_msat_limit +
2469+
num_ignored_total_fee_limit;
24532470
if num_ignored_total > 0 {
2454-
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);
2471+
log_trace!(logger,
2472+
"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.",
2473+
num_ignored_value_contribution, num_ignored_path_length_limit,
2474+
num_ignored_cltv_delta_limit, num_ignored_previously_failed,
2475+
num_ignored_htlc_minimum_msat_limit, num_ignored_avoid_overpayment,
2476+
num_ignored_total_fee_limit, num_ignored_total);
24552477
}
24562478

24572479
// Step (5).

0 commit comments

Comments
 (0)