Skip to content

Commit c7d311e

Browse files
committed
f reorder param
1 parent a7d3292 commit c7d311e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/routing/scoring.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ const BASE_AMOUNT_PENALTY_DIVISOR: u64 = 1 << 30;
10071007
/// (recently) seen an HTLC successfully complete over this channel.
10081008
#[inline(always)]
10091009
fn success_probability(
1010-
min_liquidity_msat: u64, amount_msat: u64, max_liquidity_msat: u64, _capacity_msat: u64,
1010+
amount_msat: u64, min_liquidity_msat: u64, max_liquidity_msat: u64, _capacity_msat: u64,
10111011
_params: &ProbabilisticScoringFeeParameters, _min_zero_implies_no_successes: bool,
10121012
) -> (u64, u64) {
10131013
let numerator = max_liquidity_msat - amount_msat;
@@ -1035,8 +1035,8 @@ impl<L: Deref<Target = u64>, BRT: Deref<Target = HistoricalBucketRangeTracker>,
10351035
score_params.liquidity_penalty_amount_multiplier_msat)
10361036
.saturating_add(score_params.considered_impossible_penalty_msat)
10371037
} else {
1038-
let (numerator, denominator) = success_probability(min_liquidity_msat,
1039-
amount_msat, max_liquidity_msat, available_capacity, score_params, false);
1038+
let (numerator, denominator) = success_probability(amount_msat,
1039+
min_liquidity_msat, max_liquidity_msat, available_capacity, score_params, false);
10401040
if denominator - numerator < denominator / PRECISION_LOWER_BOUND_DENOMINATOR {
10411041
// If the failure probability is < 1.5625% (as 1 - numerator/denominator < 1/64),
10421042
// don't bother trying to use the log approximation as it gets too noisy to be
@@ -1075,7 +1075,7 @@ impl<L: Deref<Target = u64>, BRT: Deref<Target = HistoricalBucketRangeTracker>,
10751075
// If we don't have any valid points (or, once decayed, we have less than a full
10761076
// point), redo the non-historical calculation with no liquidity bounds tracked and
10771077
// the historical penalty multipliers.
1078-
let (numerator, denominator) = success_probability(0, amount_msat,
1078+
let (numerator, denominator) = success_probability(amount_msat, 0,
10791079
available_capacity, available_capacity, score_params, true);
10801080
let negative_log10_times_2048 =
10811081
approx::negative_log10_times_2048(numerator, denominator);
@@ -1906,7 +1906,7 @@ mod bucketed_history {
19061906
}
19071907
let max_bucket_end_pos = BUCKET_START_POS[32 - highest_max_bucket_with_points] - 1;
19081908
if payment_pos < max_bucket_end_pos {
1909-
let (numerator, denominator) = success_probability(0, payment_pos as u64,
1909+
let (numerator, denominator) = success_probability(payment_pos as u64, 0,
19101910
max_bucket_end_pos as u64, POSITION_TICKS as u64 - 1, params, true);
19111911
let bucket_prob_times_billion =
19121912
(self.min_liquidity_offset_history.buckets[0] as u64) * total_max_points
@@ -1930,9 +1930,9 @@ mod bucketed_history {
19301930
} else if payment_pos < min_bucket_start_pos {
19311931
cumulative_success_prob_times_billion += bucket_prob_times_billion;
19321932
} else {
1933-
let (numerator, denominator) = success_probability(
1934-
min_bucket_start_pos as u64, payment_pos as u64,
1935-
max_bucket_end_pos as u64, POSITION_TICKS as u64 - 1, params, true);
1933+
let (numerator, denominator) = success_probability(payment_pos as u64,
1934+
min_bucket_start_pos as u64, max_bucket_end_pos as u64,
1935+
POSITION_TICKS as u64 - 1, params, true);
19361936
cumulative_success_prob_times_billion += bucket_prob_times_billion *
19371937
numerator / denominator;
19381938
}

0 commit comments

Comments
 (0)