@@ -490,6 +490,29 @@ fn two_hop_blinded_path_success() {
490
490
claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , payment_preimage) ;
491
491
}
492
492
493
+ #[ test]
494
+ fn three_hop_blinded_path_success ( ) {
495
+ let chanmon_cfgs = create_chanmon_cfgs ( 5 ) ;
496
+ let node_cfgs = create_node_cfgs ( 5 , & chanmon_cfgs) ;
497
+ let node_chanmgrs = create_node_chanmgrs ( 5 , & node_cfgs, & [ None , None , None , None , None ] ) ;
498
+ let mut nodes = create_network ( 5 , & node_cfgs, & node_chanmgrs) ;
499
+ create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 1_000_000 , 0 ) ;
500
+ create_announced_chan_between_nodes_with_value ( & nodes, 1 , 2 , 1_000_000 , 0 ) ;
501
+ let chan_upd_2_3 = create_announced_chan_between_nodes_with_value ( & nodes, 2 , 3 , 1_000_000 , 0 ) . 0 . contents ;
502
+ let chan_upd_3_4 = create_announced_chan_between_nodes_with_value ( & nodes, 3 , 4 , 1_000_000 , 0 ) . 0 . contents ;
503
+
504
+ let amt_msat = 5000 ;
505
+ let ( payment_preimage, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 4 ] , Some ( amt_msat) , None ) ;
506
+ let route_params = get_blinded_route_parameters ( amt_msat, payment_secret,
507
+ nodes. iter ( ) . skip ( 2 ) . map ( |n| n. node . get_our_node_id ( ) ) . collect ( ) ,
508
+ & [ & chan_upd_2_3, & chan_upd_3_4] , & chanmon_cfgs[ 4 ] . keys_manager ) ;
509
+
510
+ nodes[ 0 ] . node . send_payment ( payment_hash, RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( payment_hash. 0 ) , route_params, Retry :: Attempts ( 0 ) ) . unwrap ( ) ;
511
+ check_added_monitors ( & nodes[ 0 ] , 1 ) ;
512
+ pass_along_route ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] ] , amt_msat, payment_hash, payment_secret) ;
513
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 4 ] ] , payment_preimage) ;
514
+ }
515
+
493
516
#[ derive( PartialEq ) ]
494
517
enum ReceiveCheckFail {
495
518
// The recipient fails the payment upon `PaymentClaimable`.
0 commit comments