@@ -3001,10 +3001,18 @@ where
3001
3001
{
3002
3002
Ok(res) => res,
3003
3003
Err(onion_utils::OnionDecodeErr::Malformed { err_msg, err_code }) => {
3004
- return_malformed_err!(err_msg, err_code);
3004
+ if msg.blinding_point.is_some() {
3005
+ return_blinded_htlc_err!(err_msg);
3006
+ } else {
3007
+ return_malformed_err!(err_msg, err_code);
3008
+ }
3005
3009
},
3006
3010
Err(onion_utils::OnionDecodeErr::Relay { err_msg, err_code }) => {
3007
- return_err!(err_msg, err_code, &[0; 0]);
3011
+ if msg.blinding_point.is_some() {
3012
+ return_blinded_htlc_err!(err_msg);
3013
+ } else {
3014
+ return_err!(err_msg, err_code, &[0; 0]);
3015
+ }
3008
3016
},
3009
3017
};
3010
3018
let (outgoing_scid, outgoing_amt_msat, outgoing_cltv_value, next_packet_pk_opt, blinded)
@@ -3210,10 +3218,18 @@ where
3210
3218
($msg: expr, $err_code: expr, $data: expr) => {
3211
3219
{
3212
3220
log_info!(self.logger, "Failed to accept/forward incoming HTLC: {}", $msg);
3221
+ let (err_code, err_data) = if msg.blinding_point.is_some() {
3222
+ return PendingHTLCStatus::Fail(HTLCFailureMsg::Malformed(msgs::UpdateFailMalformedHTLC {
3223
+ channel_id: msg.channel_id,
3224
+ htlc_id: msg.htlc_id,
3225
+ sha256_of_onion: [0; 32],
3226
+ failure_code: INVALID_ONION_BLINDING,
3227
+ }))
3228
+ } else { ($err_code, $data) };
3213
3229
return PendingHTLCStatus::Fail(HTLCFailureMsg::Relay(msgs::UpdateFailHTLC {
3214
3230
channel_id: msg.channel_id,
3215
3231
htlc_id: msg.htlc_id,
3216
- reason: HTLCFailReason::reason($ err_code, $data .to_vec())
3232
+ reason: HTLCFailReason::reason(err_code, err_data .to_vec())
3217
3233
.get_encrypted_failure_packet(&shared_secret, &None),
3218
3234
}));
3219
3235
}
@@ -6109,8 +6125,21 @@ where
6109
6125
// but if we've sent a shutdown and they haven't acknowledged it yet, we just
6110
6126
// want to reject the new HTLC and fail it backwards instead of forwarding.
6111
6127
match pending_forward_info {
6112
- PendingHTLCStatus::Forward(PendingHTLCInfo { ref incoming_shared_secret, .. }) => {
6113
- let reason = if (error_code & 0x1000) != 0 {
6128
+ PendingHTLCStatus::Forward(PendingHTLCInfo {
6129
+ ref incoming_shared_secret, ref routing, ..
6130
+ }) => {
6131
+ if msg.blinding_point.is_some() {
6132
+ let fail_malformed = msgs::UpdateFailMalformedHTLC {
6133
+ channel_id: msg.channel_id,
6134
+ htlc_id: msg.htlc_id,
6135
+ sha256_of_onion: [0; 32],
6136
+ failure_code: INVALID_ONION_BLINDING,
6137
+ };
6138
+ return PendingHTLCStatus::Fail(HTLCFailureMsg::Malformed(fail_malformed))
6139
+ }
6140
+ let reason = if routing.blinded().is_some() {
6141
+ HTLCFailReason::reason(INVALID_ONION_BLINDING, vec![0; 32])
6142
+ } else if (error_code & 0x1000) != 0 {
6114
6143
let (real_code, error_data) = self.get_htlc_inbound_temp_fail_err_and_data(error_code, chan);
6115
6144
HTLCFailReason::reason(real_code, error_data)
6116
6145
} else {
0 commit comments