@@ -260,16 +260,18 @@ impl ReadableArgs<u64> for FixedPenaltyScorer {
260260}
261261
262262/// [`Score`] implementation that uses a dynamic penalty.
263+ ///
264+ /// (C-not exported)
263265pub struct DynamicPenaltyScorer < F >
264266where
265- F : Fn ( u64 , u64 , u64 , & NodeId , & NodeId ) -> u64 ,
267+ F : Fn ( u64 , & NodeId , & NodeId , ChannelUsage ) -> u64 ,
266268{
267269 penalty_func : F ,
268270}
269271
270272impl < F > DynamicPenaltyScorer < F >
271273where
272- F : Fn ( u64 , u64 , u64 , & NodeId , & NodeId ) -> u64 ,
274+ F : Fn ( u64 , & NodeId , & NodeId , ChannelUsage ) -> u64 ,
273275{
274276 /// Creates a new scorer that applies a closure `penalty_func`, which takes the same arguments
275277 /// as [`Score::channel_penalty_msat`].
@@ -281,12 +283,12 @@ where
281283
282284impl < F > Score for DynamicPenaltyScorer < F >
283285where
284- F : Fn ( u64 , u64 , u64 , & NodeId , & NodeId ) -> u64 ,
286+ F : Fn ( u64 , & NodeId , & NodeId , ChannelUsage ) -> u64 ,
285287{
286- fn channel_penalty_msat ( & self , short_channel_id : u64 , send_amt_msat : u64 , capacity_msat : u64 ,
287- source : & NodeId , target : & NodeId ) -> u64
288+ fn channel_penalty_msat ( & self , short_channel_id : u64 , source : & NodeId , target : & NodeId ,
289+ usage : ChannelUsage ) -> u64
288290 {
289- ( self . penalty_func ) ( short_channel_id, send_amt_msat , capacity_msat , source, target)
291+ ( self . penalty_func ) ( short_channel_id, source, target, usage )
290292 }
291293
292294 fn payment_path_failed ( & mut self , _path : & [ & RouteHop ] , _short_channel_id : u64 ) { }
@@ -296,7 +298,7 @@ where
296298
297299impl < F > Writeable for DynamicPenaltyScorer < F >
298300where
299- F : Fn ( u64 , u64 , u64 , & NodeId , & NodeId ) -> u64 ,
301+ F : Fn ( u64 , & NodeId , & NodeId , ChannelUsage ) -> u64 ,
300302{
301303 #[ inline]
302304 fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
@@ -307,7 +309,7 @@ where
307309
308310impl < F > ReadableArgs < F > for DynamicPenaltyScorer < F >
309311where
310- F : Fn ( u64 , u64 , u64 , & NodeId , & NodeId ) -> u64 ,
312+ F : Fn ( u64 , & NodeId , & NodeId , ChannelUsage ) -> u64 ,
311313{
312314 #[ inline]
313315 fn read < R : Read > ( r : & mut R , penalty_func : F ) -> Result < Self , DecodeError > {
0 commit comments