Skip to content

Commit 7c8fa41

Browse files
committed
f comment why its an f64
1 parent 8fbbe8f commit 7c8fa41

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
@@ -1817,6 +1817,11 @@ mod bucketed_history {
18171817
// Because the first thing we do is check if `total_valid_points` is sufficient to consider
18181818
// the data here at all, and can return early if it is not, we want this to go first to
18191819
// avoid hitting a second cache line load entirely in that case.
1820+
//
1821+
// Note that we store it as an `f64` rather than a `u64` (potentially losing some
1822+
// precision) because we ultimately need the value as an `f64` when dividing bucket weights
1823+
// by it. Storing it as an `f64` avoids doing the additional int -> float conversion in the
1824+
// hot score-calculation path.
18201825
total_valid_points_tracked: f64,
18211826
min_liquidity_offset_history: HistoricalBucketRangeTracker,
18221827
max_liquidity_offset_history: HistoricalBucketRangeTracker,

0 commit comments

Comments
 (0)