@@ -61,7 +61,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, S: Deref> Router for DefaultR
61
61
{
62
62
fn find_route (
63
63
& self , payer : & PublicKey , params : & RouteParameters , first_hops : Option < & [ & ChannelDetails ] > ,
64
- inflight_htlcs : InFlightHtlcs
64
+ inflight_htlcs : & InFlightHtlcs
65
65
) -> Result < Route , LightningError > {
66
66
let random_seed_bytes = {
67
67
let mut locked_random_seed_bytes = self . random_seed_bytes . lock ( ) . unwrap ( ) ;
@@ -98,13 +98,13 @@ pub trait Router {
98
98
/// Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
99
99
fn find_route (
100
100
& self , payer : & PublicKey , route_params : & RouteParameters ,
101
- first_hops : Option < & [ & ChannelDetails ] > , inflight_htlcs : InFlightHtlcs
101
+ first_hops : Option < & [ & ChannelDetails ] > , inflight_htlcs : & InFlightHtlcs
102
102
) -> Result < Route , LightningError > ;
103
103
/// Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes
104
104
/// `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment.
105
105
fn find_route_with_id (
106
106
& self , payer : & PublicKey , route_params : & RouteParameters ,
107
- first_hops : Option < & [ & ChannelDetails ] > , inflight_htlcs : InFlightHtlcs ,
107
+ first_hops : Option < & [ & ChannelDetails ] > , inflight_htlcs : & InFlightHtlcs ,
108
108
_payment_hash : PaymentHash , _payment_id : PaymentId
109
109
) -> Result < Route , LightningError > {
110
110
self . find_route ( payer, route_params, first_hops, inflight_htlcs)
@@ -125,15 +125,15 @@ pub trait Router {
125
125
/// [`find_route`].
126
126
///
127
127
/// [`Score`]: crate::routing::scoring::Score
128
- pub struct ScorerAccountingForInFlightHtlcs < S : Score > {
128
+ pub struct ScorerAccountingForInFlightHtlcs < ' a , S : Score > {
129
129
scorer : S ,
130
130
// Maps a channel's short channel id and its direction to the liquidity used up.
131
- inflight_htlcs : InFlightHtlcs ,
131
+ inflight_htlcs : & ' a InFlightHtlcs ,
132
132
}
133
133
134
- impl < S : Score > ScorerAccountingForInFlightHtlcs < S > {
134
+ impl < ' a , S : Score > ScorerAccountingForInFlightHtlcs < ' a , S > {
135
135
/// Initialize a new `ScorerAccountingForInFlightHtlcs`.
136
- pub fn new ( scorer : S , inflight_htlcs : InFlightHtlcs ) -> Self {
136
+ pub fn new ( scorer : S , inflight_htlcs : & ' a InFlightHtlcs ) -> Self {
137
137
ScorerAccountingForInFlightHtlcs {
138
138
scorer,
139
139
inflight_htlcs
@@ -142,11 +142,11 @@ impl<S: Score> ScorerAccountingForInFlightHtlcs<S> {
142
142
}
143
143
144
144
#[ cfg( c_bindings) ]
145
- impl < S : Score > Writeable for ScorerAccountingForInFlightHtlcs < S > {
145
+ impl < ' a , S : Score > Writeable for ScorerAccountingForInFlightHtlcs < ' a , S > {
146
146
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > { self . scorer . write ( writer) }
147
147
}
148
148
149
- impl < S : Score > Score for ScorerAccountingForInFlightHtlcs < S > {
149
+ impl < ' a , S : Score > Score for ScorerAccountingForInFlightHtlcs < ' a , S > {
150
150
fn channel_penalty_msat ( & self , short_channel_id : u64 , source : & NodeId , target : & NodeId , usage : ChannelUsage ) -> u64 {
151
151
if let Some ( used_liquidity) = self . inflight_htlcs . used_liquidity_msat (
152
152
source, target, short_channel_id
0 commit comments