Skip to content

Commit c9ae3e8

Browse files
committed
f comment why its an f64
1 parent cd89879 commit c9ae3e8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lightning/src/routing/scoring.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,6 +1805,11 @@ mod bucketed_history {
18051805
// Because the first thing we do is check if `total_valid_points` is sufficient to consider
18061806
// the data here at all, and can return early if it is not, we want this to go first to
18071807
// avoid hitting a second cache line load entirely in that case.
1808+
//
1809+
// Note that we store it as an `f64` rather than a `u64` (potentially losing some
1810+
// precision) because we ultimately need the value as an `f64` when dividing bucket weights
1811+
// by it. Storing it as an `f64` avoids doing the additional int -> float conversion in the
1812+
// hot score-calculation path.
18081813
total_valid_points_tracked: f64,
18091814
min_liquidity_offset_history: HistoricalBucketRangeTracker,
18101815
max_liquidity_offset_history: HistoricalBucketRangeTracker,

0 commit comments

Comments
 (0)