@@ -11,9 +11,12 @@ use bitcoin::blockdata::script::Builder;
1111use  bitcoin:: blockdata:: transaction:: TxOut ; 
1212use  bitcoin:: hash_types:: BlockHash ; 
1313
14+ use  lightning:: blinded_path:: { BlindedHop ,  BlindedPath } ; 
1415use  lightning:: chain:: transaction:: OutPoint ; 
1516use  lightning:: ln:: channelmanager:: { self ,  ChannelDetails ,  ChannelCounterparty } ; 
17+ use  lightning:: ln:: features:: { BlindedHopFeatures ,  Bolt12InvoiceFeatures } ; 
1618use  lightning:: ln:: msgs; 
19+ use  lightning:: offers:: invoice:: BlindedPayInfo ; 
1720use  lightning:: routing:: gossip:: { NetworkGraph ,  RoutingFees } ; 
1821use  lightning:: routing:: utxo:: { UtxoFuture ,  UtxoLookup ,  UtxoLookupError ,  UtxoResult } ; 
1922use  lightning:: routing:: router:: { find_route,  PaymentParameters ,  RouteHint ,  RouteHintHop ,  RouteParameters } ; 
@@ -278,7 +281,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
278281				net_graph. channel_failed_permanent ( short_channel_id) ; 
279282			} , 
280283			_ if  node_pks. is_empty ( )  => { } , 
281- 			_  => { 
284+ 			x  if  x %  2  ==  0  => { 
282285				let  mut  first_hops_vec = Vec :: new ( ) ; 
283286				let  first_hops = first_hops ! ( first_hops_vec) ; 
284287				let  mut  last_hops = Vec :: new ( ) ; 
@@ -315,6 +318,51 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
315318						& logger,  & scorer,  & ProbabilisticScoringFeeParameters :: default ( ) ,  & random_seed_bytes) ; 
316319				} 
317320			} , 
321+ 			_ => { 
322+ 				let  mut  first_hops_vec = Vec :: new ( ) ; 
323+ 				let  first_hops = first_hops ! ( first_hops_vec) ; 
324+ 				let  mut  last_hops = Vec :: new ( ) ; 
325+ 				{ 
326+ 					let  count = get_slice ! ( 1 ) [ 0 ] ; 
327+ 					for  _ in  0 ..count { 
328+ 						let  intro_node_id = node_pks. iter ( ) . skip ( slice_to_be16 ( get_slice ! ( 2 ) )  as  usize  % node_pks. len ( ) ) . next ( ) . unwrap ( ) ; 
329+ 						let  htlc_minimum_msat = slice_to_be64 ( get_slice ! ( 8 ) ) ; 
330+ 						let  num_blinded_hops = get_slice ! ( 1 ) [ 0 ] ; 
331+ 						let  mut  blinded_hops = Vec :: new ( ) ; 
332+ 						for  _ in  0 ..num_blinded_hops { 
333+ 							blinded_hops. push ( BlindedHop  { 
334+ 								blinded_node_id :  PublicKey :: from_slice ( & [ 2 ;  33 ] ) . unwrap ( ) , 
335+ 								encrypted_payload :  Vec :: new ( ) 
336+ 							} ) ; 
337+ 						} 
338+ 						last_hops. push ( ( BlindedPayInfo  { 
339+ 							fee_base_msat :  slice_to_be32 ( get_slice ! ( 4 ) ) , 
340+ 							fee_proportional_millionths :  slice_to_be32 ( get_slice ! ( 4 ) ) , 
341+ 							htlc_minimum_msat, 
342+ 							htlc_maximum_msat :  htlc_minimum_msat. saturating_add ( slice_to_be64 ( get_slice ! ( 8 ) ) ) , 
343+ 							cltv_expiry_delta :  slice_to_be16 ( get_slice ! ( 2 ) ) , 
344+ 							features :  BlindedHopFeatures :: empty ( ) , 
345+ 						} ,  BlindedPath  { 
346+ 							introduction_node_id :  * intro_node_id, 
347+ 							blinding_point :  PublicKey :: from_slice ( & [ 2 ;  33 ] ) . unwrap ( ) , 
348+ 							blinded_hops, 
349+ 						} ) ) ; 
350+ 					} 
351+ 				} 
352+ 				let  mut  features = Bolt12InvoiceFeatures :: empty ( ) ; 
353+ 				features. set_basic_mpp_optional ( ) ; 
354+ 				let  scorer = ProbabilisticScorer :: new ( ProbabilisticScoringDecayParameters :: default ( ) ,  & net_graph,  & logger) ; 
355+ 				let  random_seed_bytes:  [ u8 ;  32 ]  = [ get_slice ! ( 1 ) [ 0 ] ;  32 ] ; 
356+ 				let  final_value_msat = slice_to_be64 ( get_slice ! ( 8 ) ) ; 
357+ 				let  route_params = RouteParameters  { 
358+ 					payment_params :  PaymentParameters :: blinded ( last_hops. clone ( ) ) 
359+ 						. with_bolt12_features ( features. clone ( ) ) . unwrap ( ) , 
360+ 					final_value_msat, 
361+ 				} ; 
362+ 				let  _ = find_route ( & our_pubkey,  & route_params,  & net_graph, 
363+ 					first_hops. map ( |c| c. iter ( ) . collect :: < Vec < _ > > ( ) ) . as_ref ( ) . map ( |a| a. as_slice ( ) ) , 
364+ 					& logger,  & scorer,  & ProbabilisticScoringFeeParameters :: default ( ) ,  & random_seed_bytes) ; 
365+ 			} 
318366		} 
319367	} 
320368} 
0 commit comments