@@ -73,6 +73,11 @@ impl BlindedPaymentTlvs {
7373				payment_constraints. htlc_minimum_msat , 
7474		} 
7575	} 
76+ 	fn  features ( & self )  -> & BlindedHopFeatures  { 
77+ 		match  self  { 
78+ 			Self :: Forward  {  features,  .. }  | Self :: Receive  {  features,  .. }  => & features
79+ 		} 
80+ 	} 
7681} 
7782
7883/// Parameters for relaying over a given [`BlindedHop`]. 
@@ -174,6 +179,8 @@ pub(super) fn compute_payinfo(
174179	let  mut  curr_base_fee:  u32  = 0 ; 
175180	let  mut  curr_prop_mil:  u32  = 0 ; 
176181	for  ( _,  payment_tlvs)  in  path. iter ( ) . rev ( ) . skip ( 1 )  { 
182+ 		if  payment_tlvs. features ( ) . requires_unknown_bits ( )  {  return  Err ( ( ) )  } 
183+ 
177184		let  next_base_fee = payment_tlvs. fee_base_msat ( ) ; 
178185		let  next_prop_mil = payment_tlvs. fee_proportional_millionths ( ) ; 
179186		// Use integer arithmetic to compute `ceil(a/b)` as `(a+b-1)/b` 
@@ -200,7 +207,6 @@ pub(super) fn compute_payinfo(
200207		htlc_minimum_msat :  path. iter ( ) . map ( |( _,  tlvs) | tlvs. htlc_minimum_msat ( ) ) . max ( ) . unwrap_or ( 0 ) , 
201208		// TODO: this field isn't present in route blinding encrypted data 
202209		htlc_maximum_msat :  21_000_000  *  100_000_000  *  1_000 ,  // Total bitcoin supply 
203- 		// TODO: when there are blinded hop features, take the intersection of them here 
204210		features :  BlindedHopFeatures :: empty ( ) , 
205211	} ) 
206212} 
0 commit comments