diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index 0f25f108c0c..177dc02442d 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -1960,7 +1960,13 @@ 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_four = + total_weight * 4 / total_valid_points_tracked; + let bucket_prob_times_billion = bucket_prob_times_four * 1024 * 1024 * 1024 / 4; + let val = (bucket_prob_times_billion as u64) * + numerator / denominator; let bucket_prob = (total_weight as u128) * 1024 * 1024 * 1024 / total_valid_points_tracked as u128; + //assert_eq!(bucket_prob as u64, bucket_prob_times_billion as u64, "{}, {}", total_weight, total_valid_points_tracked); cumulative_success_prob_times_billion += bucket_prob as u64 * numerator / denominator; } }