@@ -190,6 +190,56 @@ fn do_one_hop_blinded_path(success: bool) {
190190 }
191191}
192192
193+ #[ test]
194+ fn one_hop_blinded_path_with_dummy_hops ( ) {
195+ let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
196+ let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
197+ let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
198+ let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
199+ let chan_upd = create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 1_000_000 , 0 ) . 0 . contents ;
200+
201+ let amt_msat = 5000 ;
202+ let ( payment_preimage, payment_hash, payment_secret) = get_payment_preimage_hash ( & nodes[ 1 ] , Some ( amt_msat) , None ) ;
203+ let payee_tlvs = ReceiveTlvs {
204+ payment_secret,
205+ payment_constraints : PaymentConstraints {
206+ max_cltv_expiry : u32:: max_value ( ) ,
207+ htlc_minimum_msat : chan_upd. htlc_minimum_msat ,
208+ } ,
209+ payment_context : PaymentContext :: Bolt12Refund ( Bolt12RefundContext { } ) ,
210+ } ;
211+ let receive_auth_key = chanmon_cfgs[ 1 ] . keys_manager . get_receive_auth_key ( ) ;
212+ let dummy_hops = 1 ;
213+
214+ let mut secp_ctx = Secp256k1 :: new ( ) ;
215+ let blinded_path = BlindedPaymentPath :: new_with_dummy_hops (
216+ & [ ] , nodes[ 1 ] . node . get_our_node_id ( ) , dummy_hops, receive_auth_key,
217+ payee_tlvs, u64:: MAX , TEST_FINAL_CLTV as u16 ,
218+ & chanmon_cfgs[ 1 ] . keys_manager , & secp_ctx
219+ ) . unwrap ( ) ;
220+
221+ let route_params = RouteParameters :: from_payment_params_and_value (
222+ PaymentParameters :: blinded ( vec ! [ blinded_path] ) ,
223+ amt_msat,
224+ ) ;
225+ nodes[ 0 ] . node . send_payment ( payment_hash, RecipientOnionFields :: spontaneous_empty ( ) ,
226+ PaymentId ( payment_hash. 0 ) , route_params, Retry :: Attempts ( 0 ) ) . unwrap ( ) ;
227+ check_added_monitors ( & nodes[ 0 ] , 1 ) ;
228+
229+ let mut events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
230+ assert_eq ! ( events. len( ) , 1 ) ;
231+ let ev = remove_first_msg_event_to_node ( & nodes[ 1 ] . node . get_our_node_id ( ) , & mut events) ;
232+
233+ let path = & [ & nodes[ 1 ] ] ;
234+ let args =
235+ PassAlongPathArgs :: new ( & nodes[ 0 ] , path, amt_msat, payment_hash, ev)
236+ . with_dummy_override ( dummy_hops)
237+ . with_payment_secret ( payment_secret) ;
238+
239+ do_pass_along_path ( args) ;
240+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage) ;
241+ }
242+
193243#[ test]
194244fn mpp_to_one_hop_blinded_path ( ) {
195245 let chanmon_cfgs = create_chanmon_cfgs ( 4 ) ;
0 commit comments