@@ -53,7 +53,7 @@ use crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParame
5353use crate::ln::onion_payment::{check_incoming_htlc_cltv, create_recv_pending_htlc_info, create_fwd_pending_htlc_info, decode_incoming_update_add_htlc_onion, InboundOnionErr, NextPacketDetails};
5454use crate::ln::msgs;
5555use crate::ln::onion_utils;
56- use crate::ln::onion_utils::HTLCFailReason;
56+ use crate::ln::onion_utils::{ HTLCFailReason, INVALID_ONION_BLINDING} ;
5757use crate::ln::msgs::{ChannelMessageHandler, DecodeError, LightningError};
5858#[cfg(test)]
5959use crate::ln::outbound_payment;
@@ -2977,14 +2977,24 @@ where
29772977 msg, &self.node_signer, &self.logger, &self.secp_ctx
29782978 )?;
29792979
2980+ let is_blinded = match next_hop {
2981+ onion_utils::Hop::Forward {
2982+ next_hop_data: msgs::InboundOnionPayload::BlindedForward { .. }, ..
2983+ } => true,
2984+ _ => false, // TODO: update this when we support receiving to multi-hop blinded paths
2985+ };
2986+
29802987 macro_rules! return_err {
29812988 ($msg: expr, $err_code: expr, $data: expr) => {
29822989 {
29832990 log_info!(self.logger, "Failed to accept/forward incoming HTLC: {}", $msg);
2991+ let (err_code, err_data) = if is_blinded {
2992+ (INVALID_ONION_BLINDING, &[0; 32][..])
2993+ } else { ($err_code, $data) };
29842994 return Err(HTLCFailureMsg::Relay(msgs::UpdateFailHTLC {
29852995 channel_id: msg.channel_id,
29862996 htlc_id: msg.htlc_id,
2987- reason: HTLCFailReason::reason($ err_code, $data .to_vec())
2997+ reason: HTLCFailReason::reason(err_code, err_data .to_vec())
29882998 .get_encrypted_failure_packet(&shared_secret, &None),
29892999 }));
29903000 }
0 commit comments