@@ -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 } ; 
@@ -279,7 +282,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
279282				net_graph. channel_failed_permanent ( short_channel_id) ; 
280283			} , 
281284			_ if  node_pks. is_empty ( )  => { } , 
282- 			_  => { 
285+ 			x  if  x <  250  => { 
283286				let  mut  first_hops_vec = Vec :: new ( ) ; 
284287				let  first_hops = first_hops ! ( first_hops_vec) ; 
285288				let  mut  last_hops = Vec :: new ( ) ; 
@@ -316,6 +319,56 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
316319						& logger,  & scorer,  & ProbabilisticScoringFeeParameters :: default ( ) ,  & random_seed_bytes) ; 
317320				} 
318321			} , 
322+ 			x => { 
323+ 				let  mut  first_hops_vec = Vec :: new ( ) ; 
324+ 				let  first_hops = first_hops ! ( first_hops_vec) ; 
325+ 				let  mut  last_hops = Vec :: new ( ) ; 
326+ 				{ 
327+ 					let  count = get_slice ! ( 1 ) [ 0 ] ; 
328+ 					for  _ in  0 ..count { 
329+ 						// Fetch values in the same order as above to improve coverage. 
330+ 						let  intro_node_id = node_pks. iter ( ) . skip ( slice_to_be16 ( get_slice ! ( 2 ) )  as  usize  % node_pks. len ( ) ) . next ( ) . unwrap ( ) ; 
331+ 						let  fee_base_msat = slice_to_be32 ( get_slice ! ( 4 ) ) ; 
332+ 						let  fee_proportional_millionths = slice_to_be32 ( get_slice ! ( 4 ) ) ; 
333+ 						let  cltv_expiry_delta = slice_to_be16 ( get_slice ! ( 2 ) ) ; 
334+ 						let  htlc_minimum_msat = slice_to_be64 ( get_slice ! ( 8 ) ) ; 
335+ 						let  payinfo = BlindedPayInfo  { 
336+ 							fee_base_msat, 
337+ 							fee_proportional_millionths, 
338+ 							htlc_minimum_msat, 
339+ 							htlc_maximum_msat :  htlc_minimum_msat. saturating_mul ( 100 ) , 
340+ 							cltv_expiry_delta, 
341+ 							features :  BlindedHopFeatures :: empty ( ) , 
342+ 						} ; 
343+ 						let  num_blinded_hops = x % 250 ; 
344+ 						let  mut  blinded_hops = Vec :: new ( ) ; 
345+ 						for  _ in  0 ..num_blinded_hops { 
346+ 							blinded_hops. push ( BlindedHop  { 
347+ 								blinded_node_id :  PublicKey :: from_slice ( & [ 2 ;  33 ] ) . unwrap ( ) , 
348+ 								encrypted_payload :  Vec :: new ( ) 
349+ 							} ) ; 
350+ 						} 
351+ 						last_hops. push ( ( payinfo,  BlindedPath  { 
352+ 							introduction_node_id :  * intro_node_id, 
353+ 							blinding_point :  PublicKey :: from_slice ( & [ 2 ;  33 ] ) . unwrap ( ) , 
354+ 							blinded_hops, 
355+ 						} ) ) ; 
356+ 					} 
357+ 				} 
358+ 				let  mut  features = Bolt12InvoiceFeatures :: empty ( ) ; 
359+ 				features. set_basic_mpp_optional ( ) ; 
360+ 				let  scorer = ProbabilisticScorer :: new ( ProbabilisticScoringDecayParameters :: default ( ) ,  & net_graph,  & logger) ; 
361+ 				let  random_seed_bytes:  [ u8 ;  32 ]  = [ get_slice ! ( 1 ) [ 0 ] ;  32 ] ; 
362+ 				let  final_value_msat = slice_to_be64 ( get_slice ! ( 8 ) ) ; 
363+ 				let  route_params = RouteParameters  { 
364+ 					payment_params :  PaymentParameters :: blinded ( last_hops. clone ( ) ) 
365+ 						. with_bolt12_features ( features. clone ( ) ) . unwrap ( ) , 
366+ 					final_value_msat, 
367+ 				} ; 
368+ 				let  _ = find_route ( & our_pubkey,  & route_params,  & net_graph, 
369+ 					first_hops. map ( |c| c. iter ( ) . collect :: < Vec < _ > > ( ) ) . as_ref ( ) . map ( |a| a. as_slice ( ) ) , 
370+ 					& logger,  & scorer,  & ProbabilisticScoringFeeParameters :: default ( ) ,  & random_seed_bytes) ; 
371+ 			} 
319372		} 
320373	} 
321374} 
0 commit comments