/// Handles updating channel penalties after a probe over the given path succeeded.
fn probe_successful(&mut self, path: &Path, duration_since_epoch: Duration);
+
+ /// Scorers may wish to reduce their certainty of channel liquidity information over time.
+ /// Thus, this method is provided to allow scorers to observe the passage of time - the holder
+ /// of this object should call this method regularly (generally via the
+ /// `lightning-background-processor` crate).
+ fn time_passed(&mut self, duration_since_epoch: Duration);
}
/// A trait which can both lookup and update routing channel penalty scores.
fn probe_successful(&mut self, path: &Path, duration_since_epoch: Duration) {
self.deref_mut().probe_successful(path, duration_since_epoch)
}
+
+ fn time_passed(&mut self, duration_since_epoch: Duration) {
+ self.deref_mut().time_passed(duration_since_epoch)
+ }
}
} }
fn probe_successful(&mut self, path: &Path, duration_since_epoch: Duration) {
self.0.probe_successful(path, duration_since_epoch)
}
+
+ fn time_passed(&mut self, duration_since_epoch: Duration) {
+ self.0.time_passed(duration_since_epoch)
+ }
}
fn probe_failed(&mut self, _path: &Path, _short_channel_id: u64, _duration_since_epoch: Duration) {}
fn probe_successful(&mut self, _path: &Path, _duration_since_epoch: Duration) {}
+
+ fn time_passed(&mut self, _duration_since_epoch: Duration) {}
}
impl Writeable for FixedPenaltyScorer {
fn probe_successful(&mut self, path: &Path, duration_since_epoch: Duration) {
self.payment_path_failed(path, u64::max_value(), duration_since_epoch)
}
+
+ fn time_passed(&mut self, _duration_since_epoch: Duration) {}
}
#[cfg(c_bindings)]