Skip to content

Commit

Permalink
lulz
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Dec 18, 2024
1 parent 755169d commit 16f38ba
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lightning/src/routing/scoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 16f38ba

Please sign in to comment.