Skip to content

Commit e677ab9

Browse files
committed
f rename fn
1 parent 6a592b6 commit e677ab9

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ macro_rules! define_run_body {
405405
if !have_decayed_scorer {
406406
if let Some(ref scorer) = $scorer {
407407
if let Some(duration_since_epoch) = $time_fetch() {
408-
scorer.write_lock().decay_liquidity_certainty(duration_since_epoch);
408+
log_trace!($logger, "Calling time_passed on scorer at startup");
409+
scorer.write_lock().time_passed(duration_since_epoch);
409410
}
410411
}
411412
have_decayed_scorer = true;
@@ -414,8 +415,8 @@ macro_rules! define_run_body {
414415
if $timer_elapsed(&mut last_scorer_persist_call, SCORER_PERSIST_TIMER) {
415416
if let Some(ref scorer) = $scorer {
416417
if let Some(duration_since_epoch) = $time_fetch() {
417-
log_trace!($logger, "Decaying and persisting scorer");
418-
scorer.write_lock().decay_liquidity_certainty(duration_since_epoch);
418+
log_trace!($logger, "Calling time_passed and persisting scorer");
419+
scorer.write_lock().time_passed(duration_since_epoch);
419420
} else {
420421
log_trace!($logger, "Persisting scorer");
421422
}
@@ -1223,7 +1224,7 @@ mod tests {
12231224
}
12241225
}
12251226
}
1226-
fn decay_liquidity_certainty(&mut self, _: Duration) {}
1227+
fn time_passed(&mut self, _: Duration) {}
12271228
}
12281229

12291230
#[cfg(c_bindings)]

lightning/src/routing/scoring.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub trait ScoreUpdate {
125125
/// Thus, this method is provided to allow scorers to observe the passage of time - the holder
126126
/// of this object should call this method regularly (generally via the
127127
/// `lightning-background-processor` crate).
128-
fn decay_liquidity_certainty(&mut self, duration_since_epoch: Duration);
128+
fn time_passed(&mut self, duration_since_epoch: Duration);
129129
}
130130

131131
/// A trait which can both lookup and update routing channel penalty scores.
@@ -167,8 +167,8 @@ impl<S: ScoreUpdate, T: DerefMut<Target=S>> ScoreUpdate for T {
167167
self.deref_mut().probe_successful(path, duration_since_epoch)
168168
}
169169

170-
fn decay_liquidity_certainty(&mut self, duration_since_epoch: Duration) {
171-
self.deref_mut().decay_liquidity_certainty(duration_since_epoch)
170+
fn time_passed(&mut self, duration_since_epoch: Duration) {
171+
self.deref_mut().time_passed(duration_since_epoch)
172172
}
173173
}
174174
} }
@@ -372,8 +372,8 @@ impl<'a, T: Score> ScoreUpdate for MultiThreadedScoreLockWrite<'a, T> {
372372
self.0.probe_successful(path, duration_since_epoch)
373373
}
374374

375-
fn decay_liquidity_certainty(&mut self, duration_since_epoch: Duration) {
376-
self.0.decay_liquidity_certainty(duration_since_epoch)
375+
fn time_passed(&mut self, duration_since_epoch: Duration) {
376+
self.0.time_passed(duration_since_epoch)
377377
}
378378
}
379379

@@ -421,7 +421,7 @@ impl ScoreUpdate for FixedPenaltyScorer {
421421

422422
fn probe_successful(&mut self, _path: &Path, _duration_since_epoch: Duration) {}
423423

424-
fn decay_liquidity_certainty(&mut self, _duration_since_epoch: Duration) {}
424+
fn time_passed(&mut self, _duration_since_epoch: Duration) {}
425425
}
426426

427427
impl Writeable for FixedPenaltyScorer {
@@ -1480,7 +1480,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
14801480
self.payment_path_failed(path, u64::max_value(), duration_since_epoch)
14811481
}
14821482

1483-
fn decay_liquidity_certainty(&mut self, _duration_since_epoch: Duration) {}
1483+
fn time_passed(&mut self, _duration_since_epoch: Duration) {}
14841484
}
14851485

14861486
#[cfg(c_bindings)]

lightning/src/util/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ impl ScoreUpdate for TestScorer {
13581358

13591359
fn probe_successful(&mut self, _actual_path: &Path, _duration_since_epoch: Duration) {}
13601360

1361-
fn decay_liquidity_certainty(&mut self, _duration_since_epoch: Duration) {}
1361+
fn time_passed(&mut self, _duration_since_epoch: Duration) {}
13621362
}
13631363

13641364
impl Drop for TestScorer {

0 commit comments

Comments
 (0)