Skip to content

Commit c57b94a

Browse files
authored
Merge pull request #2931 from TheBlueMatt/2024-03-log-outbound-channels
Log available liquidity on each channel when starting routefinding
2 parents 7d2d047 + 136e89e commit c57b94a

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

lightning/src/routing/router.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,13 +2014,29 @@ where L::Target: Logger {
20142014

20152015
let max_total_routing_fee_msat = route_params.max_total_routing_fee_msat.unwrap_or(u64::max_value());
20162016

2017+
let first_hop_count = first_hops.map(|hops| hops.len()).unwrap_or(0);
20172018
log_trace!(logger, "Searching for a route from payer {} to {} {} MPP and {} first hops {}overriding the network graph of {} nodes and {} channels with a fee limit of {} msat",
20182019
our_node_pubkey, LoggedPayeePubkey(payment_params.payee.node_id()),
20192020
if allow_mpp { "with" } else { "without" },
2020-
first_hops.map(|hops| hops.len()).unwrap_or(0), if first_hops.is_some() { "" } else { "not " },
2021+
first_hop_count, if first_hops.is_some() { "" } else { "not " },
20212022
network_graph.nodes().len(), network_graph.channels().len(),
20222023
max_total_routing_fee_msat);
20232024

2025+
if first_hop_count < 10 {
2026+
if let Some(hops) = first_hops {
2027+
for hop in hops {
2028+
log_trace!(
2029+
logger,
2030+
" First hop through {}/{} can send between {}msat and {}msat (inclusive).",
2031+
hop.counterparty.node_id,
2032+
hop.get_outbound_payment_scid().unwrap_or(0),
2033+
hop.next_outbound_htlc_minimum_msat,
2034+
hop.next_outbound_htlc_limit_msat
2035+
);
2036+
}
2037+
}
2038+
}
2039+
20242040
// Step (1).
20252041
// Prepare the data we'll use for payee-to-payer search by
20262042
// inserting first hops suggested by the caller as targets.
@@ -2227,14 +2243,9 @@ where L::Target: Logger {
22272243
// around again with a higher amount.
22282244
if !contributes_sufficient_value {
22292245
if should_log_candidate {
2230-
log_trace!(logger, "Ignoring {} due to insufficient value contribution.", LoggedCandidateHop(&$candidate));
2231-
2232-
if let Some(details) = first_hop_details {
2233-
log_trace!(logger,
2234-
"First hop candidate next_outbound_htlc_limit_msat: {}",
2235-
details.next_outbound_htlc_limit_msat,
2236-
);
2237-
}
2246+
log_trace!(logger, "Ignoring {} due to insufficient value contribution (channel max {:?}).",
2247+
LoggedCandidateHop(&$candidate),
2248+
effective_capacity);
22382249
}
22392250
num_ignored_value_contribution += 1;
22402251
} else if exceeds_max_path_length {
@@ -2263,15 +2274,8 @@ where L::Target: Logger {
22632274
} else if may_overpay_to_meet_path_minimum_msat {
22642275
if should_log_candidate {
22652276
log_trace!(logger,
2266-
"Ignoring {} to avoid overpaying to meet htlc_minimum_msat limit.",
2267-
LoggedCandidateHop(&$candidate));
2268-
2269-
if let Some(details) = first_hop_details {
2270-
log_trace!(logger,
2271-
"First hop candidate next_outbound_htlc_minimum_msat: {}",
2272-
details.next_outbound_htlc_minimum_msat,
2273-
);
2274-
}
2277+
"Ignoring {} to avoid overpaying to meet htlc_minimum_msat limit ({}).",
2278+
LoggedCandidateHop(&$candidate), $candidate.htlc_minimum_msat());
22752279
}
22762280
num_ignored_avoid_overpayment += 1;
22772281
hit_minimum_limit = true;

0 commit comments

Comments
 (0)