77
77
//! # first_hops: Option<&[&ChannelDetails]>, _inflight_htlcs: InFlightHtlcs
78
78
//! # ) -> Result<Route, LightningError> { unimplemented!() }
79
79
//! #
80
- //! # fn notify_payment_path_failed(&self, path: Vec<& RouteHop> , short_channel_id: u64) { unimplemented!() }
81
- //! # fn notify_payment_path_successful(&self, path: Vec<& RouteHop> ) { unimplemented!() }
82
- //! # fn notify_payment_probe_successful(&self, path: Vec<& RouteHop> ) { unimplemented!() }
83
- //! # fn notify_payment_probe_failed(&self, path: Vec<& RouteHop> , short_channel_id: u64) { unimplemented!() }
80
+ //! # fn notify_payment_path_failed(&self, path: &[& RouteHop] , short_channel_id: u64) { unimplemented!() }
81
+ //! # fn notify_payment_path_successful(&self, path: &[& RouteHop] ) { unimplemented!() }
82
+ //! # fn notify_payment_probe_successful(&self, path: &[& RouteHop] ) { unimplemented!() }
83
+ //! # fn notify_payment_probe_failed(&self, path: &[& RouteHop] , short_channel_id: u64) { unimplemented!() }
84
84
//! # }
85
85
//! #
86
86
//! # struct FakeScorer {}
@@ -273,13 +273,13 @@ pub trait Router {
273
273
first_hops : Option < & [ & ChannelDetails ] > , inflight_htlcs : InFlightHtlcs
274
274
) -> Result < Route , LightningError > ;
275
275
/// Lets the router know that payment through a specific path has failed.
276
- fn notify_payment_path_failed ( & self , path : Vec < & RouteHop > , short_channel_id : u64 ) ;
276
+ fn notify_payment_path_failed ( & self , path : & [ & RouteHop ] , short_channel_id : u64 ) ;
277
277
/// Lets the router know that payment through a specific path was successful.
278
- fn notify_payment_path_successful ( & self , path : Vec < & RouteHop > ) ;
278
+ fn notify_payment_path_successful ( & self , path : & [ & RouteHop ] ) ;
279
279
/// Lets the router know that a payment probe was successful.
280
- fn notify_payment_probe_successful ( & self , path : Vec < & RouteHop > ) ;
280
+ fn notify_payment_probe_successful ( & self , path : & [ & RouteHop ] ) ;
281
281
/// Lets the router know that a payment probe failed.
282
- fn notify_payment_probe_failed ( & self , path : Vec < & RouteHop > , short_channel_id : u64 ) ;
282
+ fn notify_payment_probe_failed ( & self , path : & [ & RouteHop ] , short_channel_id : u64 ) ;
283
283
}
284
284
285
285
/// Strategies available to retry payment path failures for an [`Invoice`].
@@ -680,7 +680,7 @@ where
680
680
} => {
681
681
if let Some ( short_channel_id) = short_channel_id {
682
682
let path = path. iter ( ) . collect :: < Vec < _ > > ( ) ;
683
- self . router . notify_payment_path_failed ( path, * short_channel_id)
683
+ self . router . notify_payment_path_failed ( & path, * short_channel_id)
684
684
}
685
685
686
686
if payment_id. is_none ( ) {
@@ -703,7 +703,7 @@ where
703
703
} ,
704
704
Event :: PaymentPathSuccessful { path, .. } => {
705
705
let path = path. iter ( ) . collect :: < Vec < _ > > ( ) ;
706
- self . router . notify_payment_path_successful ( path) ;
706
+ self . router . notify_payment_path_successful ( & path) ;
707
707
} ,
708
708
Event :: PaymentSent { payment_hash, .. } => {
709
709
let mut payment_cache = self . payment_cache . lock ( ) . unwrap ( ) ;
@@ -715,13 +715,13 @@ where
715
715
Event :: ProbeSuccessful { payment_hash, path, .. } => {
716
716
log_trace ! ( self . logger, "Probe payment {} of {}msat was successful" , log_bytes!( payment_hash. 0 ) , path. last( ) . unwrap( ) . fee_msat) ;
717
717
let path = path. iter ( ) . collect :: < Vec < _ > > ( ) ;
718
- self . router . notify_payment_probe_successful ( path) ;
718
+ self . router . notify_payment_probe_successful ( & path) ;
719
719
} ,
720
720
Event :: ProbeFailed { payment_hash, path, short_channel_id, .. } => {
721
721
if let Some ( short_channel_id) = short_channel_id {
722
722
log_trace ! ( self . logger, "Probe payment {} of {}msat failed at channel {}" , log_bytes!( payment_hash. 0 ) , path. last( ) . unwrap( ) . fee_msat, * short_channel_id) ;
723
723
let path = path. iter ( ) . collect :: < Vec < _ > > ( ) ;
724
- self . router . notify_payment_probe_failed ( path, * short_channel_id) ;
724
+ self . router . notify_payment_probe_failed ( & path, * short_channel_id) ;
725
725
}
726
726
} ,
727
727
_ => { } ,
@@ -1844,19 +1844,19 @@ mod tests {
1844
1844
} )
1845
1845
}
1846
1846
1847
- fn notify_payment_path_failed ( & self , path : Vec < & RouteHop > , short_channel_id : u64 ) {
1847
+ fn notify_payment_path_failed ( & self , path : & [ & RouteHop ] , short_channel_id : u64 ) {
1848
1848
self . scorer . lock ( ) . payment_path_failed ( & path, short_channel_id) ;
1849
1849
}
1850
1850
1851
- fn notify_payment_path_successful ( & self , path : Vec < & RouteHop > ) {
1851
+ fn notify_payment_path_successful ( & self , path : & [ & RouteHop ] ) {
1852
1852
self . scorer . lock ( ) . payment_path_successful ( & path) ;
1853
1853
}
1854
1854
1855
- fn notify_payment_probe_successful ( & self , path : Vec < & RouteHop > ) {
1855
+ fn notify_payment_probe_successful ( & self , path : & [ & RouteHop ] ) {
1856
1856
self . scorer . lock ( ) . probe_successful ( & path) ;
1857
1857
}
1858
1858
1859
- fn notify_payment_probe_failed ( & self , path : Vec < & RouteHop > , short_channel_id : u64 ) {
1859
+ fn notify_payment_probe_failed ( & self , path : & [ & RouteHop ] , short_channel_id : u64 ) {
1860
1860
self . scorer . lock ( ) . probe_failed ( & path, short_channel_id) ;
1861
1861
}
1862
1862
}
@@ -1871,13 +1871,13 @@ mod tests {
1871
1871
Err ( LightningError { err : String :: new ( ) , action : ErrorAction :: IgnoreError } )
1872
1872
}
1873
1873
1874
- fn notify_payment_path_failed ( & self , _path : Vec < & RouteHop > , _short_channel_id : u64 ) { }
1874
+ fn notify_payment_path_failed ( & self , _path : & [ & RouteHop ] , _short_channel_id : u64 ) { }
1875
1875
1876
- fn notify_payment_path_successful ( & self , _path : Vec < & RouteHop > ) { }
1876
+ fn notify_payment_path_successful ( & self , _path : & [ & RouteHop ] ) { }
1877
1877
1878
- fn notify_payment_probe_successful ( & self , _path : Vec < & RouteHop > ) { }
1878
+ fn notify_payment_probe_successful ( & self , _path : & [ & RouteHop ] ) { }
1879
1879
1880
- fn notify_payment_probe_failed ( & self , _path : Vec < & RouteHop > , _short_channel_id : u64 ) { }
1880
+ fn notify_payment_probe_failed ( & self , _path : & [ & RouteHop ] , _short_channel_id : u64 ) { }
1881
1881
}
1882
1882
1883
1883
struct TestScorer {
@@ -2133,13 +2133,13 @@ mod tests {
2133
2133
self . 0 . borrow_mut ( ) . pop_front ( ) . unwrap ( )
2134
2134
}
2135
2135
2136
- fn notify_payment_path_failed ( & self , _path : Vec < & RouteHop > , _short_channel_id : u64 ) { }
2136
+ fn notify_payment_path_failed ( & self , _path : & [ & RouteHop ] , _short_channel_id : u64 ) { }
2137
2137
2138
- fn notify_payment_path_successful ( & self , _path : Vec < & RouteHop > ) { }
2138
+ fn notify_payment_path_successful ( & self , _path : & [ & RouteHop ] ) { }
2139
2139
2140
- fn notify_payment_probe_successful ( & self , _path : Vec < & RouteHop > ) { }
2140
+ fn notify_payment_probe_successful ( & self , _path : & [ & RouteHop ] ) { }
2141
2141
2142
- fn notify_payment_probe_failed ( & self , _path : Vec < & RouteHop > , _short_channel_id : u64 ) { }
2142
+ fn notify_payment_probe_failed ( & self , _path : & [ & RouteHop ] , _short_channel_id : u64 ) { }
2143
2143
}
2144
2144
impl ManualRouter {
2145
2145
fn expect_find_route ( & self , result : Result < Route , LightningError > ) {
0 commit comments