File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -1453,26 +1453,17 @@ where L::Target: Logger {
14531453 let mut random_index_bytes = [ 0u8 ; :: core:: mem:: size_of :: < usize > ( ) ] ;
14541454
14551455 let num_permutations = payment_paths. len ( ) ;
1456- let mut seen_permutation_scids: HashSet < Vec < Vec < u64 > > > = HashSet :: new ( ) ;
14571456 for _ in 0 ..num_permutations {
14581457 let mut cur_route = Vec :: < PaymentPath > :: new ( ) ;
14591458 let mut aggregate_route_value_msat = 0 ;
14601459
14611460 // Step (6).
1462- // Do a Fisher-Yates shuffle to create a unique permutation of the payment paths
1463- loop {
1464- for cur_index in ( 1 ..payment_paths. len ( ) ) . rev ( ) {
1465- prng. process_in_place ( & mut random_index_bytes) ;
1466- let random_index = usize:: from_be_bytes ( random_index_bytes) . wrapping_rem ( cur_index+1 ) ;
1467- payment_paths. swap ( cur_index, random_index) ;
1468- }
1469- let cur_perm_scids = payment_paths. iter ( ) . map ( |path|
1470- path. hops . iter ( ) . map ( |( hop, _) | hop. candidate . short_channel_id ( ) ) . collect :: < Vec < u64 > > ( )
1471- ) . collect :: < Vec < Vec < u64 > > > ( ) ;
1472- if seen_permutation_scids. insert ( cur_perm_scids) {
1473- break ;
1474- }
1475- } ;
1461+ // Do a Fisher-Yates shuffle to create a random permutation of the payment paths
1462+ for cur_index in ( 1 ..payment_paths. len ( ) ) . rev ( ) {
1463+ prng. process_in_place ( & mut random_index_bytes) ;
1464+ let random_index = usize:: from_be_bytes ( random_index_bytes) . wrapping_rem ( cur_index+1 ) ;
1465+ payment_paths. swap ( cur_index, random_index) ;
1466+ }
14761467
14771468 // Step (7).
14781469 for payment_path in & payment_paths {
You can’t perform that action at this time.
0 commit comments