@@ -296,7 +296,7 @@ where
296296 InboundHTLCErr { msg, err_code, err_data }
297297 } ) ?;
298298 Ok ( match hop {
299- onion_utils:: Hop :: Forward { next_hop_data , next_hop_hmac, new_packet_bytes } => {
299+ onion_utils:: Hop :: Forward { next_hop_hmac , new_packet_bytes , .. } | onion_utils :: Hop :: BlindedForward { next_hop_hmac, new_packet_bytes, .. } => {
300300 let NextPacketDetails {
301301 next_packet_pubkey, outgoing_amt_msat : _, outgoing_scid : _, outgoing_cltv_value
302302 } = match next_packet_details_opt {
@@ -310,7 +310,7 @@ where
310310 } ;
311311
312312 if let Err ( ( err_msg, code) ) = check_incoming_htlc_cltv (
313- cur_height, outgoing_cltv_value, msg. cltv_expiry
313+ cur_height, outgoing_cltv_value, msg. cltv_expiry ,
314314 ) {
315315 return Err ( InboundHTLCErr {
316316 msg : err_msg,
@@ -322,52 +322,27 @@ where
322322 // TODO: If this is potentially a phantom payment we should decode the phantom payment
323323 // onion here and check it.
324324
325- create_fwd_pending_htlc_info (
326- msg, msgs:: InboundOnionPayload :: Forward ( next_hop_data) , next_hop_hmac, new_packet_bytes, shared_secret,
327- Some ( next_packet_pubkey)
328- ) ?
329- } ,
330- onion_utils:: Hop :: BlindedForward { next_hop_data, next_hop_hmac, new_packet_bytes } => {
331- let NextPacketDetails {
332- next_packet_pubkey, outgoing_amt_msat : _, outgoing_scid : _, outgoing_cltv_value
333- } = match next_packet_details_opt {
334- Some ( next_packet_details) => next_packet_details,
335- // Forward should always include the next hop details
336- None => return Err ( InboundHTLCErr {
337- msg : "Failed to decode update add htlc onion" ,
338- err_code : 0x4000 | 22 ,
339- err_data : Vec :: new ( ) ,
340- } ) ,
325+ let inbound_onion_payload = match hop {
326+ onion_utils:: Hop :: Forward { next_hop_data, .. } => msgs:: InboundOnionPayload :: Forward ( next_hop_data) ,
327+ onion_utils:: Hop :: BlindedForward { next_hop_data, .. } => msgs:: InboundOnionPayload :: BlindedForward ( next_hop_data) ,
328+ _ => unreachable ! ( )
341329 } ;
342330
343- if let Err ( ( err_msg, code) ) = check_incoming_htlc_cltv (
344- cur_height, outgoing_cltv_value, msg. cltv_expiry
345- ) {
346- return Err ( InboundHTLCErr {
347- msg : err_msg,
348- err_code : code,
349- err_data : Vec :: new ( ) ,
350- } ) ;
351- }
352-
353- // TODO: If this is potentially a phantom payment we should decode the phantom payment
354- // onion here and check it.
355-
356331 create_fwd_pending_htlc_info (
357- msg, msgs :: InboundOnionPayload :: BlindedForward ( next_hop_data ) , next_hop_hmac, new_packet_bytes, shared_secret,
358- Some ( next_packet_pubkey)
332+ msg, inbound_onion_payload , next_hop_hmac, new_packet_bytes, shared_secret,
333+ Some ( next_packet_pubkey) ,
359334 ) ?
360335 } ,
361336 onion_utils:: Hop :: Receive ( received_data) => {
362337 create_recv_pending_htlc_info (
363338 msgs:: InboundOnionPayload :: Receive ( received_data) , shared_secret, msg. payment_hash , msg. amount_msat , msg. cltv_expiry ,
364- None , allow_skimmed_fees, msg. skimmed_fee_msat , cur_height
339+ None , allow_skimmed_fees, msg. skimmed_fee_msat , cur_height,
365340 ) ?
366341 } ,
367342 onion_utils:: Hop :: BlindedReceive ( received_data) => {
368343 create_recv_pending_htlc_info (
369344 msgs:: InboundOnionPayload :: BlindedReceive ( received_data) , shared_secret, msg. payment_hash , msg. amount_msat , msg. cltv_expiry ,
370- None , allow_skimmed_fees, msg. skimmed_fee_msat , cur_height
345+ None , allow_skimmed_fees, msg. skimmed_fee_msat , cur_height,
371346 ) ?
372347 }
373348 } )
0 commit comments