Skip to content

Commit d88198b

Browse files
committed
Ignore fees on first-hop channels from the public network graph
If we have a first-hop channel from a first-hop hint, we'll ignore the fees on it as we won't charge ourselves fees. However, if we have a first-hop channel from the network graph, we should do the same. We do so here, also teeing up a coming commit which will remove much of the custom codepath for first-hop hints and start using this common codepath as well.
1 parent a91196b commit d88198b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lightning/src/routing/router.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2514,8 +2514,15 @@ where L::Target: Logger {
25142514
let curr_min = cmp::max(
25152515
$next_hops_path_htlc_minimum_msat, htlc_minimum_msat
25162516
);
2517-
let candidate_fees = $candidate.fees();
25182517
let src_node_counter = $candidate.src_node_counter();
2518+
let mut candidate_fees = $candidate.fees();
2519+
if src_node_counter == payer_node_counter {
2520+
// We do not charge ourselves a fee to use our own channels.
2521+
candidate_fees = RoutingFees {
2522+
proportional_millionths: 0,
2523+
base_msat: 0,
2524+
};
2525+
}
25192526
let path_htlc_minimum_msat = compute_fees_saturating(curr_min, candidate_fees)
25202527
.saturating_add(curr_min);
25212528

0 commit comments

Comments
 (0)