Update history bucket last_update time immediately on update
authorMatt Corallo <git@bluematt.me>
Wed, 29 Nov 2023 03:07:54 +0000 (03:07 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 9 Dec 2023 00:53:48 +0000 (00:53 +0000)
Now that we aren't decaying during scoring, when we set the
last_updated time in the history bucket logic doesn't matter, so
we should just update it when we've just updated the history
buckets.

lightning/src/routing/scoring.rs

index 81e85407ae00338d37c40fd7a8afbfae7f1c574f..e37da41755566c160983619988e74477f7095501 100644 (file)
@@ -1318,6 +1318,7 @@ impl<L: DerefMut<Target = u64>, BRT: DerefMut<Target = HistoricalBucketRangeTrac
                self.liquidity_history.max_liquidity_offset_history.track_datapoint(
                        max_liquidity_offset_msat.saturating_sub(bucket_offset_msat), self.capacity_msat
                );
+               *self.offset_history_last_updated = self.now;
        }
 
        /// Adjusts the lower bound of the channel liquidity balance in this direction.
@@ -1329,7 +1330,6 @@ impl<L: DerefMut<Target = u64>, BRT: DerefMut<Target = HistoricalBucketRangeTrac
                        self.decayed_offset_msat(*self.max_liquidity_offset_msat)
                };
                *self.last_updated = self.now;
-               *self.offset_history_last_updated = self.now;
        }
 
        /// Adjusts the upper bound of the channel liquidity balance in this direction.
@@ -1341,7 +1341,6 @@ impl<L: DerefMut<Target = u64>, BRT: DerefMut<Target = HistoricalBucketRangeTrac
                        self.decayed_offset_msat(*self.min_liquidity_offset_msat)
                };
                *self.last_updated = self.now;
-               *self.offset_history_last_updated = self.now;
        }
 }