Skip to content

Commit bb1119e

Browse files
committed
f - Add units to decayed_penalty
1 parent a273aa7 commit bb1119e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lightning/src/routing/scorer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ impl ChannelFailure {
127127
}
128128

129129
fn add_penalty(&mut self, failure_penalty_msat: u64, half_life: Duration) {
130-
self.undecayed_penalty_msat = self.decayed_penalty(half_life) + failure_penalty_msat;
130+
self.undecayed_penalty_msat = self.decayed_penalty_msat(half_life) + failure_penalty_msat;
131131
#[cfg(not(feature = "no-std"))]
132132
{
133133
self.last_failed = Instant::now();
134134
}
135135
}
136136

137-
fn decayed_penalty(&self, half_life: Duration) -> u64 {
137+
fn decayed_penalty_msat(&self, half_life: Duration) -> u64 {
138138
let decays = self.elapsed().as_secs().checked_div(half_life.as_secs());
139139
match decays {
140140
Some(decays) => self.undecayed_penalty_msat >> decays,
@@ -172,7 +172,7 @@ impl routing::Score for Scorer {
172172
) -> u64 {
173173
let failure_penalty_msat = self.channel_failures
174174
.get(&short_channel_id)
175-
.map_or(0, |failure| failure.decayed_penalty(self.params.failure_penalty_half_life));
175+
.map_or(0, |value| value.decayed_penalty_msat(self.params.failure_penalty_half_life));
176176

177177
self.params.base_penalty_msat + failure_penalty_msat
178178
}

0 commit comments

Comments
 (0)