@@ -61,7 +61,6 @@ use crate::routing::gossip::{EffectiveCapacity, NetworkGraph, NodeId};
6161use crate :: routing:: router:: Path ;
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} ;
@@ -441,13 +440,6 @@ impl ReadableArgs<u64> for FixedPenaltyScorer {
441440 }
442441}
443442
444- #[ cfg( not( feature = "no-std" ) ) ]
445- type ConfiguredTime = crate :: util:: time:: MonotonicTime ;
446- #[ cfg( feature = "no-std" ) ]
447- use crate :: util:: time:: Eternity ;
448- #[ cfg( feature = "no-std" ) ]
449- type ConfiguredTime = Eternity ;
450-
451443/// [`ScoreLookUp`] implementation using channel success probability distributions.
452444///
453445/// Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
@@ -484,18 +476,12 @@ type ConfiguredTime = Eternity;
484476/// [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
485477/// [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_multiplier_msat
486478/// [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_amount_multiplier_msat
487- pub type ProbabilisticScorer < G , L > = ProbabilisticScorerUsingTime :: < G , L , ConfiguredTime > ;
488-
489- /// Probabilistic [`ScoreLookUp`] implementation.
490- ///
491- /// This is not exported to bindings users generally all users should use the [`ProbabilisticScorer`] type alias.
492- pub struct ProbabilisticScorerUsingTime < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time >
479+ pub struct ProbabilisticScorer < G : Deref < Target = NetworkGraph < L > > , L : Deref >
493480where L :: Target : Logger {
494481 decay_params : ProbabilisticScoringDecayParameters ,
495482 network_graph : G ,
496483 logger : L ,
497484 channel_liquidities : HashMap < u64 , ChannelLiquidity > ,
498- _unused_time : core:: marker:: PhantomData < T > ,
499485}
500486
501487/// Parameters for configuring [`ProbabilisticScorer`].
@@ -750,7 +736,7 @@ pub struct ProbabilisticScoringDecayParameters {
750736 ///
751737 /// Default value: 14 days
752738 ///
753- /// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime ::historical_estimated_channel_liquidity_probabilities
739+ /// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer ::historical_estimated_channel_liquidity_probabilities
754740 pub historical_no_updates_half_life : Duration ,
755741
756742 /// Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
@@ -829,7 +815,7 @@ struct DirectedChannelLiquidity<L: Deref<Target = u64>, BRT: Deref<Target = Hist
829815 decay_params : ProbabilisticScoringDecayParameters ,
830816}
831817
832- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
818+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > ProbabilisticScorer < G , L > where L :: Target : Logger {
833819 /// Creates a new scorer using the given scoring parameters for sending payments from a node
834820 /// through a network graph.
835821 pub fn new ( decay_params : ProbabilisticScoringDecayParameters , network_graph : G , logger : L ) -> Self {
@@ -838,7 +824,6 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerU
838824 network_graph,
839825 logger,
840826 channel_liquidities : HashMap :: new ( ) ,
841- _unused_time : core:: marker:: PhantomData ,
842827 }
843828 }
844829
@@ -1353,7 +1338,7 @@ DirectedChannelLiquidity<L, BRT, T> {
13531338 }
13541339}
13551340
1356- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > ScoreLookUp for ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
1341+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > ScoreLookUp for ProbabilisticScorer < G , L > where L :: Target : Logger {
13571342 type ScoreParams = ProbabilisticScoringFeeParameters ;
13581343 fn channel_penalty_msat (
13591344 & self , short_channel_id : u64 , source : & NodeId , target : & NodeId , usage : ChannelUsage , score_params : & ProbabilisticScoringFeeParameters
@@ -1397,7 +1382,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreLookUp for Prob
13971382 }
13981383}
13991384
1400- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > ScoreUpdate for ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
1385+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > ScoreUpdate for ProbabilisticScorer < G , L > where L :: Target : Logger {
14011386 fn payment_path_failed ( & mut self , path : & Path , short_channel_id : u64 , duration_since_epoch : Duration ) {
14021387 let amount_msat = path. final_value_msat ( ) ;
14031388 log_trace ! ( self . logger, "Scoring path through to SCID {} as having failed at {} msat" , short_channel_id, amount_msat) ;
@@ -1504,7 +1489,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
15041489}
15051490
15061491#[ cfg( c_bindings) ]
1507- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > Score for ProbabilisticScorerUsingTime < G , L , T >
1492+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > Score for ProbabilisticScorer < G , L >
15081493where L :: Target : Logger { }
15091494
15101495#[ cfg( feature = "std" ) ]
@@ -2090,7 +2075,7 @@ mod bucketed_history {
20902075}
20912076use bucketed_history:: { LegacyHistoricalBucketRangeTracker , HistoricalBucketRangeTracker , HistoricalMinMaxBuckets } ;
20922077
2093- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time > Writeable for ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
2078+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > Writeable for ProbabilisticScorer < G , L > where L :: Target : Logger {
20942079 #[ inline]
20952080 fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
20962081 write_tlv_fields ! ( w, {
@@ -2100,8 +2085,8 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> Writeable for Probab
21002085 }
21012086}
21022087
2103- impl < G : Deref < Target = NetworkGraph < L > > , L : Deref , T : Time >
2104- ReadableArgs < ( ProbabilisticScoringDecayParameters , G , L ) > for ProbabilisticScorerUsingTime < G , L , T > where L :: Target : Logger {
2088+ impl < G : Deref < Target = NetworkGraph < L > > , L : Deref >
2089+ ReadableArgs < ( ProbabilisticScoringDecayParameters , G , L ) > for ProbabilisticScorer < G , L > where L :: Target : Logger {
21052090 #[ inline]
21062091 fn read < R : Read > (
21072092 r : & mut R , args : ( ProbabilisticScoringDecayParameters , G , L )
@@ -2116,7 +2101,6 @@ ReadableArgs<(ProbabilisticScoringDecayParameters, G, L)> for ProbabilisticScore
21162101 network_graph,
21172102 logger,
21182103 channel_liquidities,
2119- _unused_time : core:: marker:: PhantomData ,
21202104 } )
21212105 }
21222106}
@@ -2186,7 +2170,7 @@ impl Readable for ChannelLiquidity {
21862170
21872171#[ cfg( test) ]
21882172mod tests {
2189- use super :: { ChannelLiquidity , HistoricalBucketRangeTracker , ProbabilisticScoringFeeParameters , ProbabilisticScoringDecayParameters , ProbabilisticScorerUsingTime } ;
2173+ use super :: { ChannelLiquidity , HistoricalBucketRangeTracker , ProbabilisticScoringFeeParameters , ProbabilisticScoringDecayParameters , ProbabilisticScorer } ;
21902174 use crate :: blinded_path:: { BlindedHop , BlindedPath } ;
21912175 use crate :: util:: config:: UserConfig ;
21922176 use crate :: util:: time:: tests:: SinceEpoch ;
@@ -2235,9 +2219,6 @@ mod tests {
22352219
22362220 // `ProbabilisticScorer` tests
22372221
2238- /// A probabilistic scorer for testing with time that can be manually advanced.
2239- type ProbabilisticScorer < ' a > = ProbabilisticScorerUsingTime :: < & ' a NetworkGraph < & ' a TestLogger > , & ' a TestLogger , SinceEpoch > ;
2240-
22412222 fn sender_privkey ( ) -> SecretKey {
22422223 SecretKey :: from_slice ( & [ 41 ; 32 ] ) . unwrap ( )
22432224 }
@@ -3039,7 +3020,7 @@ mod tests {
30393020
30403021 let mut serialized_scorer = io:: Cursor :: new ( & serialized_scorer) ;
30413022 let deserialized_scorer =
3042- <ProbabilisticScorer >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
3023+ <ProbabilisticScorer < _ , _ > >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
30433024 assert_eq ! ( deserialized_scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 300 ) ;
30443025 }
30453026
@@ -3077,7 +3058,7 @@ mod tests {
30773058
30783059 let mut serialized_scorer = io:: Cursor :: new ( & serialized_scorer) ;
30793060 let mut deserialized_scorer =
3080- <ProbabilisticScorer >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
3061+ <ProbabilisticScorer < _ , _ > >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
30813062 if !decay_before_reload {
30823063 SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
30833064 scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 ) ) ;
0 commit comments