File tree 1 file changed +7
-8
lines changed 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -1520,14 +1520,13 @@ where L::Target: Logger {
1520
1520
for path in selected_paths. iter_mut ( ) {
1521
1521
let mut shadow_ctlv_expiry_delta_offset: u32 = 0 ;
1522
1522
1523
- // Choose starting point for the random walk
1524
- let mut cur_node_id = if network_nodes. contains_key ( & payee_node_id) {
1525
- payee_node_id
1526
- } else {
1527
- assert_eq ! ( payee_node_id, NodeId :: from_pubkey( & path. last( ) . unwrap( ) . as_ref( ) . unwrap( ) . pubkey) ) ;
1528
- assert ! ( path. len( ) > 1 ) ;
1529
- NodeId :: from_pubkey ( & path. iter ( ) . rev ( ) . next ( ) . unwrap ( ) . as_ref ( ) . unwrap ( ) . pubkey )
1530
- } ;
1523
+ // Choose the last publicly known node as the starting point for the random walk
1524
+ let mut cur_node_iter = path. iter ( ) . rev ( ) ;
1525
+ let mut cur_node_id = NodeId :: from_pubkey ( & cur_node_iter. next ( ) . unwrap ( ) . as_ref ( ) . unwrap ( ) . pubkey ) ;
1526
+ assert_eq ! ( cur_node_id, payee_node_id) ;
1527
+ while !network_nodes. contains_key ( & cur_node_id) {
1528
+ cur_node_id = NodeId :: from_pubkey ( & cur_node_iter. next ( ) . unwrap ( ) . as_ref ( ) . unwrap ( ) . pubkey ) ;
1529
+ }
1531
1530
1532
1531
// Init PRNG
1533
1532
let mut path_nonce = [ 0u8 ; 8 ] ;
You can’t perform that action at this time.
0 commit comments