]> git.bitcoin.ninja Git - rust-lightning/commitdiff
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>
Wed, 13 Dec 2023 23:26:09 +0000 (23:26 +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 d0766b6a78a54b297d70460a7d96be875814815f..72720245f5f1eddaa5f0b8b83427c5a3d61c51e1 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;
        }
 }