@@ -296,7 +296,7 @@ where
296
296
InboundHTLCErr { msg, err_code, err_data }
297
297
} ) ?;
298
298
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, .. } => {
300
300
let NextPacketDetails {
301
301
next_packet_pubkey, outgoing_amt_msat : _, outgoing_scid : _, outgoing_cltv_value
302
302
} = match next_packet_details_opt {
@@ -310,7 +310,7 @@ where
310
310
} ;
311
311
312
312
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 ,
314
314
) {
315
315
return Err ( InboundHTLCErr {
316
316
msg : err_msg,
@@ -322,52 +322,27 @@ where
322
322
// TODO: If this is potentially a phantom payment we should decode the phantom payment
323
323
// onion here and check it.
324
324
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 ! ( )
341
329
} ;
342
330
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
-
356
331
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) ,
359
334
) ?
360
335
} ,
361
336
onion_utils:: Hop :: Receive ( received_data) => {
362
337
create_recv_pending_htlc_info (
363
338
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,
365
340
) ?
366
341
} ,
367
342
onion_utils:: Hop :: BlindedReceive ( received_data) => {
368
343
create_recv_pending_htlc_info (
369
344
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,
371
346
) ?
372
347
}
373
348
} )
0 commit comments