File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -1460,23 +1460,22 @@ where L::Target: Logger {
1460
1460
1461
1461
// Step (6).
1462
1462
// Do a Fisher-Yates shuffle to create a unique permutation of the payment paths
1463
- let cur_payment_paths = loop {
1464
- let mut cur_perm = payment_paths. clone ( ) ;
1465
- for cur_index in ( 1 ..cur_perm. len ( ) ) . rev ( ) {
1463
+ loop {
1464
+ for cur_index in ( 1 ..payment_paths. len ( ) ) . rev ( ) {
1466
1465
prng. process_in_place ( & mut random_index_bytes) ;
1467
1466
let random_index = usize:: from_be_bytes ( random_index_bytes) . wrapping_rem ( cur_index+1 ) ;
1468
- cur_perm . swap ( cur_index, random_index) ;
1467
+ payment_paths . swap ( cur_index, random_index) ;
1469
1468
}
1470
- let cur_perm_scids = cur_perm . iter ( ) . map ( |path|
1469
+ let cur_perm_scids = payment_paths . iter ( ) . map ( |path|
1471
1470
path. hops . iter ( ) . map ( |( hop, _) | hop. candidate . short_channel_id ( ) ) . collect :: < Vec < u64 > > ( )
1472
1471
) . collect :: < Vec < Vec < u64 > > > ( ) ;
1473
1472
if seen_permutation_scids. insert ( cur_perm_scids) {
1474
- break cur_perm ;
1473
+ break ;
1475
1474
}
1476
1475
} ;
1477
1476
1478
1477
// Step (7).
1479
- for payment_path in cur_payment_paths {
1478
+ for payment_path in & payment_paths {
1480
1479
cur_route. push ( payment_path. clone ( ) ) ;
1481
1480
aggregate_route_value_msat += payment_path. get_value_msat ( ) ;
1482
1481
if aggregate_route_value_msat > final_value_msat {
You can’t perform that action at this time.
0 commit comments