From 16f38ba934bf03b739a3ff737be05d29181beae0 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 18 Dec 2024 16:28:42 +0000 Subject: [PATCH] lulz --- lightning/src/routing/scoring.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index 2e4f3889594..74d52a18bdc 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -1207,7 +1207,7 @@ fn success_probability( // Note that we prefer to increase the denominator rather than decrease the numerator as // the denominator is more likely to be larger and thus provide greater precision. This is // mostly an overoptimization but makes a large difference in tests. - denominator = denominator * 81 / 64 + denominator = denominator * 78 / 64 } (numerator, denominator) @@ -1938,9 +1938,9 @@ mod bucketed_history { if payment_pos < max_bucket_end_pos { let (numerator, denominator) = success_probability(payment_pos as u64, 0, max_bucket_end_pos as u64, POSITION_TICKS as u64 - 1, params, true); - let bucket_prob_times_thousand = - total_weight * 1024 / total_valid_points_tracked; - let bucket_prob_times_billion = bucket_prob_times_thousand * 1024 * 1024; + let bucket_prob_times_four = + total_weight * 4 / total_valid_points_tracked; + let bucket_prob_times_billion = bucket_prob_times_four * 1024 * 1024 * 1024 / 4; debug_assert!(bucket_prob_times_billion <= 1 << 30); cumulative_success_prob_times_billion += (bucket_prob_times_billion as u64) * numerator / denominator; @@ -1954,9 +1954,9 @@ mod bucketed_history { let mut bucket_weight = (*min_bucket as u64) * (*max_bucket as u64); bucket_weight *= bucket_weight; debug_assert!(bucket_weight <= total_valid_points_tracked); - let bucket_prob_times_million = - bucket_weight * 1024 * 1024 / total_valid_points_tracked; - let bucket_prob_times_billion = bucket_prob_times_million * 1024; + let bucket_prob_times_thousand = + bucket_weight * 1024 / total_valid_points_tracked; + let bucket_prob_times_billion = bucket_prob_times_thousand * 1024 * 1024; debug_assert!(bucket_prob_times_billion <= 1 << 30); if payment_pos >= max_bucket_end_pos { // Success probability 0, the payment amount may be above the max liquidity