Skip to content

Commit 2b0af98

Browse files
f remove unnecessary hint_candidate_contribution_msat calculation
1 parent 6cc524b commit 2b0af98

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning/src/routing/router.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,12 +1839,8 @@ where L::Target: Logger {
18391839
})
18401840
.unwrap_or_else(|| CandidateRouteHop::PrivateHop { hint: hop });
18411841

1842-
let used_liquidity_msat = used_channel_liquidities
1843-
.get(&(hop.short_channel_id, source < target)).copied().unwrap_or(0);
1844-
let hint_candidate_contribution_msat = cmp::min(path_value_msat,
1845-
candidate.effective_capacity().as_msat().saturating_sub(used_liquidity_msat));
18461842
if !add_entry!(candidate, source, target, aggregate_next_hops_fee_msat,
1847-
hint_candidate_contribution_msat, aggregate_next_hops_path_htlc_minimum_msat,
1843+
path_value_msat, aggregate_next_hops_path_htlc_minimum_msat,
18481844
aggregate_next_hops_path_penalty_msat, aggregate_next_hops_cltv_delta,
18491845
aggregate_next_hops_path_length) {
18501846
// If this hop was not used then there is no use checking the preceding
@@ -1853,6 +1849,8 @@ where L::Target: Logger {
18531849
hop_used = false;
18541850
}
18551851

1852+
let used_liquidity_msat = used_channel_liquidities
1853+
.get(&(hop.short_channel_id, source < target)).copied().unwrap_or(0);
18561854
let channel_usage = ChannelUsage {
18571855
amount_msat: final_value_msat + aggregate_next_hops_fee_msat,
18581856
inflight_htlc_msat: used_liquidity_msat,
@@ -1871,6 +1869,8 @@ where L::Target: Logger {
18711869
.saturating_add(1);
18721870

18731871
// Searching for a direct channel between last checked hop and first_hop_targets
1872+
let hint_candidate_contribution_msat = cmp::min(path_value_msat,
1873+
candidate.effective_capacity().as_msat().saturating_sub(used_liquidity_msat));
18741874
if let Some(first_channels) = first_hop_targets.get(&NodeId::from_pubkey(&prev_hop_id)) {
18751875
for details in first_channels {
18761876
let first_hop_candidate = CandidateRouteHop::FirstHop { details };

0 commit comments

Comments
 (0)