From 4cb2eb05e1da2d9893ac6d01ee2e75c27dbaec3e Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 18 Dec 2024 16:23:17 +0000 Subject: [PATCH] fucmillionk --- lightning/src/routing/scoring.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index 0f71084de13..1325de0d088 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -1938,8 +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_billion = - total_weight * 1024 * 1024 * 1024 / total_valid_points_tracked; + let bucket_prob_times_thousand = + total_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); cumulative_success_prob_times_billion += (bucket_prob_times_billion as u64) * numerator / denominator; @@ -1953,8 +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_billion = - bucket_weight * 1024 * 1024 * 1024 / 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; 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