Skip to content

Commit 82b3826

Browse files
committed
WIP: Balance certainty for ProbabilisticScorer
1 parent 25486bd commit 82b3826

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lightning/src/routing/scoring.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,17 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for Probabilistic
13781378
.saturating_add(anti_probing_penalty_msat)
13791379
.saturating_add(base_penalty_msat)
13801380
}
1381+
1382+
fn channel_balance_certainty(&self, short_channel_id: u64, info: &DirectedChannelInfo) -> f64 {
1383+
self.channel_liquidities
1384+
.get(&short_channel_id)
1385+
.map(|channel|
1386+
((channel.min_liquidity_offset_msat + channel.max_liquidity_offset_msat) as f64)
1387+
/ info.effective_capacity().as_msat() as f64
1388+
)
1389+
.and_then(|certainty| certainty.is_finite().then(|| certainty))
1390+
.unwrap_or(0.0)
1391+
}
13811392
}
13821393

13831394
impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreUpdate for ProbabilisticScorer<G, L> where L::Target: Logger {

0 commit comments

Comments
 (0)