Skip to content

Commit 980bd1b

Browse files
TheBlueMattadi2011
authored andcommitted
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 089d9b9 commit 980bd1b

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
@@ -2546,8 +2546,15 @@ where L::Target: Logger {
25462546
let curr_min = cmp::max(
25472547
$next_hops_path_htlc_minimum_msat, htlc_minimum_msat
25482548
);
2549-
let candidate_fees = $candidate.fees();
25502549
let src_node_counter = $candidate.src_node_counter();
2550+
let mut candidate_fees = $candidate.fees();
2551+
if src_node_counter == payer_node_counter {
2552+
// We do not charge ourselves a fee to use our own channels.
2553+
candidate_fees = RoutingFees {
2554+
proportional_millionths: 0,
2555+
base_msat: 0,
2556+
};
2557+
}
25512558
let path_htlc_minimum_msat = compute_fees_saturating(curr_min, candidate_fees)
25522559
.saturating_add(curr_min);
25532560

0 commit comments

Comments
 (0)