@@ -236,26 +236,21 @@ fn update_scorer<'a, S: 'static + Deref<Target = SC> + Send + Sync, SC: 'a + Wri
236
236
let mut score = scorer. lock ( ) ;
237
237
match event {
238
238
Event :: PaymentPathFailed { ref path, short_channel_id : Some ( scid) , .. } => {
239
- let path = path. hops . iter ( ) . collect :: < Vec < _ > > ( ) ;
240
- score. payment_path_failed ( & path, * scid) ;
239
+ score. payment_path_failed ( path, * scid) ;
241
240
} ,
242
241
Event :: PaymentPathFailed { ref path, payment_failed_permanently : true , .. } => {
243
242
// Reached if the destination explicitly failed it back. We treat this as a successful probe
244
243
// because the payment made it all the way to the destination with sufficient liquidity.
245
- let path = path. hops . iter ( ) . collect :: < Vec < _ > > ( ) ;
246
- score. probe_successful ( & path) ;
244
+ score. probe_successful ( path) ;
247
245
} ,
248
246
Event :: PaymentPathSuccessful { path, .. } => {
249
- let path = path. hops . iter ( ) . collect :: < Vec < _ > > ( ) ;
250
- score. payment_path_successful ( & path) ;
247
+ score. payment_path_successful ( path) ;
251
248
} ,
252
249
Event :: ProbeSuccessful { path, .. } => {
253
- let path = path. hops . iter ( ) . collect :: < Vec < _ > > ( ) ;
254
- score. probe_successful ( & path) ;
250
+ score. probe_successful ( path) ;
255
251
} ,
256
252
Event :: ProbeFailed { path, short_channel_id : Some ( scid) , .. } => {
257
- let path = path. hops . iter ( ) . collect :: < Vec < _ > > ( ) ;
258
- score. probe_failed ( & path, * scid) ;
253
+ score. probe_failed ( path, * scid) ;
259
254
} ,
260
255
_ => { } ,
261
256
}
@@ -916,11 +911,11 @@ mod tests {
916
911
& self , _short_channel_id : u64 , _source : & NodeId , _target : & NodeId , _usage : ChannelUsage
917
912
) -> u64 { unimplemented ! ( ) ; }
918
913
919
- fn payment_path_failed ( & mut self , actual_path : & [ & RouteHop ] , actual_short_channel_id : u64 ) {
914
+ fn payment_path_failed ( & mut self , actual_path : & Path , actual_short_channel_id : u64 ) {
920
915
if let Some ( expectations) = & mut self . event_expectations {
921
916
match expectations. pop_front ( ) . unwrap ( ) {
922
917
TestResult :: PaymentFailure { path, short_channel_id } => {
923
- assert_eq ! ( actual_path, & path. hops . iter ( ) . collect :: < Vec <_>> ( ) [ .. ] ) ;
918
+ assert_eq ! ( actual_path, & path) ;
924
919
assert_eq ! ( actual_short_channel_id, short_channel_id) ;
925
920
} ,
926
921
TestResult :: PaymentSuccess { path } => {
@@ -936,14 +931,14 @@ mod tests {
936
931
}
937
932
}
938
933
939
- fn payment_path_successful ( & mut self , actual_path : & [ & RouteHop ] ) {
934
+ fn payment_path_successful ( & mut self , actual_path : & Path ) {
940
935
if let Some ( expectations) = & mut self . event_expectations {
941
936
match expectations. pop_front ( ) . unwrap ( ) {
942
937
TestResult :: PaymentFailure { path, .. } => {
943
938
panic ! ( "Unexpected payment path failure: {:?}" , path)
944
939
} ,
945
940
TestResult :: PaymentSuccess { path } => {
946
- assert_eq ! ( actual_path, & path. hops . iter ( ) . collect :: < Vec <_>> ( ) [ .. ] ) ;
941
+ assert_eq ! ( actual_path, & path) ;
947
942
} ,
948
943
TestResult :: ProbeFailure { path } => {
949
944
panic ! ( "Unexpected probe failure: {:?}" , path)
@@ -955,7 +950,7 @@ mod tests {
955
950
}
956
951
}
957
952
958
- fn probe_failed ( & mut self , actual_path : & [ & RouteHop ] , _: u64 ) {
953
+ fn probe_failed ( & mut self , actual_path : & Path , _: u64 ) {
959
954
if let Some ( expectations) = & mut self . event_expectations {
960
955
match expectations. pop_front ( ) . unwrap ( ) {
961
956
TestResult :: PaymentFailure { path, .. } => {
@@ -965,15 +960,15 @@ mod tests {
965
960
panic ! ( "Unexpected payment path success: {:?}" , path)
966
961
} ,
967
962
TestResult :: ProbeFailure { path } => {
968
- assert_eq ! ( actual_path, & path. hops . iter ( ) . collect :: < Vec <_>> ( ) [ .. ] ) ;
963
+ assert_eq ! ( actual_path, & path) ;
969
964
} ,
970
965
TestResult :: ProbeSuccess { path } => {
971
966
panic ! ( "Unexpected probe success: {:?}" , path)
972
967
}
973
968
}
974
969
}
975
970
}
976
- fn probe_successful ( & mut self , actual_path : & [ & RouteHop ] ) {
971
+ fn probe_successful ( & mut self , actual_path : & Path ) {
977
972
if let Some ( expectations) = & mut self . event_expectations {
978
973
match expectations. pop_front ( ) . unwrap ( ) {
979
974
TestResult :: PaymentFailure { path, .. } => {
@@ -986,7 +981,7 @@ mod tests {
986
981
panic ! ( "Unexpected probe failure: {:?}" , path)
987
982
} ,
988
983
TestResult :: ProbeSuccess { path } => {
989
- assert_eq ! ( actual_path, & path. hops . iter ( ) . collect :: < Vec <_>> ( ) [ .. ] ) ;
984
+ assert_eq ! ( actual_path, & path) ;
990
985
}
991
986
}
992
987
}
0 commit comments