@@ -236,25 +236,20 @@ 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. iter ( ) . collect :: < Vec < _ > > ( ) ;
240
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. iter ( ) . collect :: < Vec < _ > > ( ) ;
246
244
score. probe_successful ( & path) ;
247
245
} ,
248
246
Event :: PaymentPathSuccessful { path, .. } => {
249
- let path = path. iter ( ) . collect :: < Vec < _ > > ( ) ;
250
247
score. payment_path_successful ( & path) ;
251
248
} ,
252
249
Event :: ProbeSuccessful { path, .. } => {
253
- let path = path. iter ( ) . collect :: < Vec < _ > > ( ) ;
254
250
score. probe_successful ( & path) ;
255
251
} ,
256
252
Event :: ProbeFailed { path, short_channel_id : Some ( scid) , .. } => {
257
- let path = path. iter ( ) . collect :: < Vec < _ > > ( ) ;
258
253
score. probe_failed ( & path, * scid) ;
259
254
} ,
260
255
_ => { } ,
@@ -748,7 +743,7 @@ mod tests {
748
743
use lightning:: ln:: msgs:: { ChannelMessageHandler , Init } ;
749
744
use lightning:: ln:: peer_handler:: { PeerManager , MessageHandler , SocketDescriptor , IgnoringMessageHandler } ;
750
745
use lightning:: routing:: gossip:: { NetworkGraph , NodeId , P2PGossipSync } ;
751
- use lightning:: routing:: router:: { DefaultRouter , RouteHop } ;
746
+ use lightning:: routing:: router:: { DefaultRouter , Path , RouteHop } ;
752
747
use lightning:: routing:: scoring:: { ChannelUsage , Score } ;
753
748
use lightning:: util:: config:: UserConfig ;
754
749
use lightning:: util:: ser:: Writeable ;
@@ -888,10 +883,10 @@ mod tests {
888
883
889
884
#[ derive( Debug ) ]
890
885
enum TestResult {
891
- PaymentFailure { path : Vec < RouteHop > , short_channel_id : u64 } ,
892
- PaymentSuccess { path : Vec < RouteHop > } ,
893
- ProbeFailure { path : Vec < RouteHop > } ,
894
- ProbeSuccess { path : Vec < RouteHop > } ,
886
+ PaymentFailure { path : Path , short_channel_id : u64 } ,
887
+ PaymentSuccess { path : Path } ,
888
+ ProbeFailure { path : Path } ,
889
+ ProbeSuccess { path : Path } ,
895
890
}
896
891
897
892
impl TestScorer {
@@ -913,11 +908,11 @@ mod tests {
913
908
& self , _short_channel_id : u64 , _source : & NodeId , _target : & NodeId , _usage : ChannelUsage
914
909
) -> u64 { unimplemented ! ( ) ; }
915
910
916
- fn payment_path_failed ( & mut self , actual_path : & [ & RouteHop ] , actual_short_channel_id : u64 ) {
911
+ fn payment_path_failed ( & mut self , actual_path : & Path , actual_short_channel_id : u64 ) {
917
912
if let Some ( expectations) = & mut self . event_expectations {
918
913
match expectations. pop_front ( ) . unwrap ( ) {
919
914
TestResult :: PaymentFailure { path, short_channel_id } => {
920
- assert_eq ! ( actual_path, & path. iter ( ) . collect :: < Vec <_>> ( ) [ .. ] ) ;
915
+ assert_eq ! ( actual_path, & path) ;
921
916
assert_eq ! ( actual_short_channel_id, short_channel_id) ;
922
917
} ,
923
918
TestResult :: PaymentSuccess { path } => {
@@ -933,14 +928,14 @@ mod tests {
933
928
}
934
929
}
935
930
936
- fn payment_path_successful ( & mut self , actual_path : & [ & RouteHop ] ) {
931
+ fn payment_path_successful ( & mut self , actual_path : & Path ) {
937
932
if let Some ( expectations) = & mut self . event_expectations {
938
933
match expectations. pop_front ( ) . unwrap ( ) {
939
934
TestResult :: PaymentFailure { path, .. } => {
940
935
panic ! ( "Unexpected payment path failure: {:?}" , path)
941
936
} ,
942
937
TestResult :: PaymentSuccess { path } => {
943
- assert_eq ! ( actual_path, & path. iter ( ) . collect :: < Vec <_>> ( ) [ .. ] ) ;
938
+ assert_eq ! ( actual_path, & path) ;
944
939
} ,
945
940
TestResult :: ProbeFailure { path } => {
946
941
panic ! ( "Unexpected probe failure: {:?}" , path)
@@ -952,7 +947,7 @@ mod tests {
952
947
}
953
948
}
954
949
955
- fn probe_failed ( & mut self , actual_path : & [ & RouteHop ] , _: u64 ) {
950
+ fn probe_failed ( & mut self , actual_path : & Path , _: u64 ) {
956
951
if let Some ( expectations) = & mut self . event_expectations {
957
952
match expectations. pop_front ( ) . unwrap ( ) {
958
953
TestResult :: PaymentFailure { path, .. } => {
@@ -962,15 +957,15 @@ mod tests {
962
957
panic ! ( "Unexpected payment path success: {:?}" , path)
963
958
} ,
964
959
TestResult :: ProbeFailure { path } => {
965
- assert_eq ! ( actual_path, & path. iter ( ) . collect :: < Vec <_>> ( ) [ .. ] ) ;
960
+ assert_eq ! ( actual_path, & path) ;
966
961
} ,
967
962
TestResult :: ProbeSuccess { path } => {
968
963
panic ! ( "Unexpected probe success: {:?}" , path)
969
964
}
970
965
}
971
966
}
972
967
}
973
- fn probe_successful ( & mut self , actual_path : & [ & RouteHop ] ) {
968
+ fn probe_successful ( & mut self , actual_path : & Path ) {
974
969
if let Some ( expectations) = & mut self . event_expectations {
975
970
match expectations. pop_front ( ) . unwrap ( ) {
976
971
TestResult :: PaymentFailure { path, .. } => {
@@ -983,7 +978,7 @@ mod tests {
983
978
panic ! ( "Unexpected probe failure: {:?}" , path)
984
979
} ,
985
980
TestResult :: ProbeSuccess { path } => {
986
- assert_eq ! ( actual_path, & path. iter ( ) . collect :: < Vec <_>> ( ) [ .. ] ) ;
981
+ assert_eq ! ( actual_path, & path) ;
987
982
}
988
983
}
989
984
}
@@ -1431,14 +1426,14 @@ mod tests {
1431
1426
let node_1_privkey = SecretKey :: from_slice ( & [ 42 ; 32 ] ) . unwrap ( ) ;
1432
1427
let node_1_id = PublicKey :: from_secret_key ( & secp_ctx, & node_1_privkey) ;
1433
1428
1434
- let path = vec ! [ RouteHop {
1429
+ let path = Path { hops : vec ! [ RouteHop {
1435
1430
pubkey: node_1_id,
1436
1431
node_features: NodeFeatures :: empty( ) ,
1437
1432
short_channel_id: scored_scid,
1438
1433
channel_features: ChannelFeatures :: empty( ) ,
1439
1434
fee_msat: 0 ,
1440
1435
cltv_expiry_delta: MIN_CLTV_EXPIRY_DELTA as u32 ,
1441
- } ] ;
1436
+ } ] , blinded_tail : None } ;
1442
1437
1443
1438
nodes[ 0 ] . scorer . lock ( ) . unwrap ( ) . expect ( TestResult :: PaymentFailure { path : path. clone ( ) , short_channel_id : scored_scid } ) ;
1444
1439
nodes[ 0 ] . node . push_pending_event ( Event :: PaymentPathFailed {
0 commit comments