Skip to content

Commit

Permalink
WIP: Balance certainty for ProbabilisticScorer
Browse files Browse the repository at this point in the history
  • Loading branch information
jkczyz committed Jun 4, 2024
1 parent bda9b52 commit db46590
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lightning/src/routing/scoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,17 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for Probabilistic
.saturating_add(anti_probing_penalty_msat)
.saturating_add(base_penalty_msat)
}

fn channel_balance_certainty(&self, short_channel_id: u64, info: &DirectedChannelInfo) -> f64 {
self.channel_liquidities
.get(&short_channel_id)
.map(|channel|
((channel.min_liquidity_offset_msat + channel.max_liquidity_offset_msat) as f64)
/ info.effective_capacity().as_msat() as f64
)
.and_then(|certainty| certainty.is_finite().then(|| certainty))
.unwrap_or(0.0)
}
}

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

0 comments on commit db46590

Please sign in to comment.