@@ -1839,12 +1839,8 @@ where L::Target: Logger {
1839
1839
} )
1840
1840
. unwrap_or_else ( || CandidateRouteHop :: PrivateHop { hint : hop } ) ;
1841
1841
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) ) ;
1846
1842
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,
1848
1844
aggregate_next_hops_path_penalty_msat, aggregate_next_hops_cltv_delta,
1849
1845
aggregate_next_hops_path_length) {
1850
1846
// If this hop was not used then there is no use checking the preceding
@@ -1853,6 +1849,8 @@ where L::Target: Logger {
1853
1849
hop_used = false ;
1854
1850
}
1855
1851
1852
+ let used_liquidity_msat = used_channel_liquidities
1853
+ . get ( & ( hop. short_channel_id , source < target) ) . copied ( ) . unwrap_or ( 0 ) ;
1856
1854
let channel_usage = ChannelUsage {
1857
1855
amount_msat : final_value_msat + aggregate_next_hops_fee_msat,
1858
1856
inflight_htlc_msat : used_liquidity_msat,
@@ -1871,6 +1869,8 @@ where L::Target: Logger {
1871
1869
. saturating_add ( 1 ) ;
1872
1870
1873
1871
// 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) ) ;
1874
1874
if let Some ( first_channels) = first_hop_targets. get ( & NodeId :: from_pubkey ( & prev_hop_id) ) {
1875
1875
for details in first_channels {
1876
1876
let first_hop_candidate = CandidateRouteHop :: FirstHop { details } ;
0 commit comments