Skip to content

Commit db46590

Browse files
committed
WIP: Balance certainty for ProbabilisticScorer
1 parent bda9b52 commit db46590

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
@@ -1377,6 +1377,17 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for Probabilistic
13771377
.saturating_add(anti_probing_penalty_msat)
13781378
.saturating_add(base_penalty_msat)
13791379
}
1380+
1381+
fn channel_balance_certainty(&self, short_channel_id: u64, info: &DirectedChannelInfo) -> f64 {
1382+
self.channel_liquidities
1383+
.get(&short_channel_id)
1384+
.map(|channel|
1385+
((channel.min_liquidity_offset_msat + channel.max_liquidity_offset_msat) as f64)
1386+
/ info.effective_capacity().as_msat() as f64
1387+
)
1388+
.and_then(|certainty| certainty.is_finite().then(|| certainty))
1389+
.unwrap_or(0.0)
1390+
}
13801391
}
13811392

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

0 commit comments

Comments
 (0)