+ pub(super) fn has_datapoints(&self) -> bool {
+ self.min_liquidity_offset_history.buckets != [0; 32] ||
+ self.max_liquidity_offset_history.buckets != [0; 32]
+ }
+
+ pub(super) fn decay_buckets(&mut self, half_lives: f64) {
+ let divisor = powf64(2048.0, half_lives) as u64;
+ for bucket in self.min_liquidity_offset_history.buckets.iter_mut() {
+ *bucket = ((*bucket as u64) * 1024 / divisor) as u16;
+ }
+ for bucket in self.max_liquidity_offset_history.buckets.iter_mut() {
+ *bucket = ((*bucket as u64) * 1024 / divisor) as u16;
+ }
+ }
+
+ pub(super) fn writeable_min_offset_history(&self) -> &HistoricalBucketRangeTracker {
+ &self.min_liquidity_offset_history
+ }
+
+ pub(super) fn writeable_max_offset_history(&self) -> &HistoricalBucketRangeTracker {
+ &self.max_liquidity_offset_history
+ }
+