@@ -61,7 +61,6 @@ use crate::routing::gossip::{EffectiveCapacity, NetworkGraph, NodeId};
6161use crate :: routing:: router:: { Path , CandidateRouteHop } ;
6262use crate :: util:: ser:: { Readable , ReadableArgs , Writeable , Writer } ;
6363use crate :: util:: logger:: Logger ;
64- use crate :: util:: time:: Time ;
6564
6665use crate :: prelude:: * ;
6766use core:: { cmp, fmt} ;
@@ -440,13 +439,6 @@ impl ReadableArgs<u64> for FixedPenaltyScorer {
440439 }
441440}
442441
443- #[ cfg( not( feature = "no-std" ) ) ]
444- type ConfiguredTime = crate :: util:: time:: MonotonicTime ;
445- #[ cfg( feature = "no-std" ) ]
446- use crate :: util:: time:: Eternity ;
447- #[ cfg( feature = "no-std" ) ]
448- type ConfiguredTime = Eternity ;
449-
450442/// [`ScoreLookUp`] implementation using channel success probability distributions.
451443///
452444/// Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
@@ -483,18 +475,12 @@ type ConfiguredTime = Eternity;
483475/// [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
484476/// [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_multiplier_msat
485477/// [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_amount_multiplier_msat
486- pub type ProbabilisticScorer < G , L > = ProbabilisticScorerUsingTime :: < G , L , ConfiguredTime > ;
487-
488- /// Probabilistic [`ScoreLookUp`] implementation.
489- ///
490- /// This is not exported to bindings users generally all users should use the [`ProbabilisticScorer`] type alias.
491- pub struct ProbabilisticScorerUsingTime < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time >
478+ pub struct ProbabilisticScorer < G : Deref < Target = NetworkGraph < L > > , L : Deref >
492479where L :: Target : Logger {
493480 decay_params : ProbabilisticScoringDecayParameters ,
494481 network_graph : G ,
495482 logger : L ,
496483 channel_liquidities : HashMap < u64 , ChannelLiquidity > ,
497- _unused_time : core:: marker:: PhantomData < T > ,
498484}
499485
500486/// Parameters for configuring [`ProbabilisticScorer`].
@@ -749,7 +735,7 @@ pub struct ProbabilisticScoringDecayParameters {
749735 ///
750736 /// Default value: 14 days
751737 ///
752- /// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime ::historical_estimated_channel_liquidity_probabilities
738+ /// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer ::historical_estimated_channel_liquidity_probabilities
753739 pub historical_no_updates_half_life : Duration ,
754740
755741 /// Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
@@ -827,7 +813,7 @@ struct DirectedChannelLiquidity<L: Deref<Target = u64>, BRT: Deref<Target = Hist
827813 decay_params : ProbabilisticScoringDecayParameters ,
828814}
829815
830- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
816+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > ProbabilisticScorer < G , L > where L :: Target : Logger {
831817 /// Creates a new scorer using the given scoring parameters for sending payments from a node
832818 /// through a network graph.
833819 pub fn new ( decay_params : ProbabilisticScoringDecayParameters , network_graph : G , logger : L ) -> Self {
@@ -836,7 +822,6 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerU
836822 network_graph,
837823 logger,
838824 channel_liquidities : HashMap :: new ( ) ,
839- _unused_time : core:: marker:: PhantomData ,
840825 }
841826 }
842827
@@ -1351,7 +1336,7 @@ DirectedChannelLiquidity<L, BRT, T> {
13511336 }
13521337}
13531338
1354- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > ScoreLookUp for ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
1339+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > ScoreLookUp for ProbabilisticScorer < G , L > where L :: Target : Logger {
13551340 type ScoreParams = ProbabilisticScoringFeeParameters ;
13561341 fn channel_penalty_msat (
13571342 & self , candidate : & CandidateRouteHop , usage : ChannelUsage , score_params : & ProbabilisticScoringFeeParameters
@@ -1402,7 +1387,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreLookUp for Prob
14021387 }
14031388}
14041389
1405- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > ScoreUpdate for ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
1390+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > ScoreUpdate for ProbabilisticScorer < G , L > where L :: Target : Logger {
14061391 fn payment_path_failed ( & mut self , path : & Path , short_channel_id : u64 , duration_since_epoch : Duration ) {
14071392 let amount_msat = path. final_value_msat ( ) ;
14081393 log_trace ! ( self . logger, "Scoring path through to SCID {} as having failed at {} msat" , short_channel_id, amount_msat) ;
@@ -1511,7 +1496,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
15111496}
15121497
15131498#[ cfg( c_bindings) ]
1514- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > Score for ProbabilisticScorerUsingTime < G , L , T >
1499+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > Score for ProbabilisticScorer < G , L >
15151500where L :: Target : Logger { }
15161501
15171502#[ cfg( feature = "std" ) ]
@@ -2097,7 +2082,7 @@ mod bucketed_history {
20972082}
20982083use bucketed_history:: { LegacyHistoricalBucketRangeTracker , HistoricalBucketRangeTracker , HistoricalMinMaxBuckets } ;
20992084
2100- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > Writeable for ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
2085+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > Writeable for ProbabilisticScorer < G , L > where L :: Target : Logger {
21012086 #[ inline]
21022087 fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
21032088 write_tlv_fields ! ( w, {
@@ -2107,8 +2092,8 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> Writeable for Probab
21072092 }
21082093}
21092094
2110- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time >
2111- ReadableArgs < ( ProbabilisticScoringDecayParameters , G , L ) > for ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
2095+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref >
2096+ ReadableArgs < ( ProbabilisticScoringDecayParameters , G , L ) > for ProbabilisticScorer < G , L > where L :: Target : Logger {
21122097 #[ inline]
21132098 fn read < R : Read > (
21142099 r : & mut R , args : ( ProbabilisticScoringDecayParameters , G , L )
@@ -2123,7 +2108,6 @@ ReadableArgs<(ProbabilisticScoringDecayParameters, G, L)> for ProbabilisticScore
21232108 network_graph,
21242109 logger,
21252110 channel_liquidities,
2126- _unused_time : core:: marker:: PhantomData ,
21272111 } )
21282112 }
21292113}
@@ -2194,7 +2178,7 @@ impl Readable for ChannelLiquidity {
21942178
21952179#[ cfg( test) ]
21962180mod tests {
2197- use super :: { ChannelLiquidity , HistoricalBucketRangeTracker , ProbabilisticScoringFeeParameters , ProbabilisticScoringDecayParameters , ProbabilisticScorerUsingTime } ;
2181+ use super :: { ChannelLiquidity , HistoricalBucketRangeTracker , ProbabilisticScoringFeeParameters , ProbabilisticScoringDecayParameters , ProbabilisticScorer } ;
21982182 use crate :: blinded_path:: { BlindedHop , BlindedPath } ;
21992183 use crate :: util:: config:: UserConfig ;
22002184 use crate :: util:: time:: tests:: SinceEpoch ;
@@ -2243,9 +2227,6 @@ mod tests {
22432227
22442228 // `ProbabilisticScorer` tests
22452229
2246- /// A probabilistic scorer for testing with time that can be manually advanced.
2247- type ProbabilisticScorer < ' a > = ProbabilisticScorerUsingTime :: < & ' a NetworkGraph < & ' a TestLogger > , & ' a TestLogger , SinceEpoch > ;
2248-
22492230 fn sender_privkey ( ) -> SecretKey {
22502231 SecretKey :: from_slice ( & [ 41 ; 32 ] ) . unwrap ( )
22512232 }
@@ -3138,7 +3119,7 @@ mod tests {
31383119
31393120 let mut serialized_scorer = io:: Cursor :: new ( & serialized_scorer) ;
31403121 let deserialized_scorer =
3141- <ProbabilisticScorer >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
3122+ <ProbabilisticScorer < _ , _ > >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
31423123 assert_eq ! ( deserialized_scorer. channel_penalty_msat( & candidate, usage, & params) , 300 ) ;
31433124 }
31443125
@@ -3181,7 +3162,7 @@ mod tests {
31813162
31823163 let mut serialized_scorer = io:: Cursor :: new ( & serialized_scorer) ;
31833164 let mut deserialized_scorer =
3184- <ProbabilisticScorer >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
3165+ <ProbabilisticScorer < _ , _ > >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
31853166 if !decay_before_reload {
31863167 SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
31873168 scorer. time_passed ( Duration :: from_secs ( 10 ) ) ;
0 commit comments