@@ -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)
@@ -3205,10 +3213,18 @@ where
3205
3213
($msg: expr, $err_code: expr, $data: expr) => {
3206
3214
{
3207
3215
log_info!(self.logger, "Failed to accept/forward incoming HTLC: {}", $msg);
3216
+ let (err_code, err_data) = if msg.blinding_point.is_some() {
3217
+ return PendingHTLCStatus::Fail(HTLCFailureMsg::Malformed(msgs::UpdateFailMalformedHTLC {
3218
+ channel_id: msg.channel_id,
3219
+ htlc_id: msg.htlc_id,
3220
+ sha256_of_onion: [0; 32],
3221
+ failure_code: INVALID_ONION_BLINDING,
3222
+ }))
3223
+ } else { ($err_code, $data) };
3208
3224
return PendingHTLCStatus::Fail(HTLCFailureMsg::Relay(msgs::UpdateFailHTLC {
3209
3225
channel_id: msg.channel_id,
3210
3226
htlc_id: msg.htlc_id,
3211
- reason: HTLCFailReason::reason($ err_code, $data .to_vec())
3227
+ reason: HTLCFailReason::reason(err_code, err_data .to_vec())
3212
3228
.get_encrypted_failure_packet(&shared_secret, &None),
3213
3229
}));
3214
3230
}
@@ -6104,8 +6120,21 @@ where
6104
6120
// but if we've sent a shutdown and they haven't acknowledged it yet, we just
6105
6121
// want to reject the new HTLC and fail it backwards instead of forwarding.
6106
6122
match pending_forward_info {
6107
- PendingHTLCStatus::Forward(PendingHTLCInfo { ref incoming_shared_secret, .. }) => {
6108
- let reason = if (error_code & 0x1000) != 0 {
6123
+ PendingHTLCStatus::Forward(PendingHTLCInfo {
6124
+ ref incoming_shared_secret, ref routing, ..
6125
+ }) => {
6126
+ if msg.blinding_point.is_some() {
6127
+ let fail_malformed = msgs::UpdateFailMalformedHTLC {
6128
+ channel_id: msg.channel_id,
6129
+ htlc_id: msg.htlc_id,
6130
+ sha256_of_onion: [0; 32],
6131
+ failure_code: INVALID_ONION_BLINDING,
6132
+ };
6133
+ return PendingHTLCStatus::Fail(HTLCFailureMsg::Malformed(fail_malformed))
6134
+ }
6135
+ let reason = if routing.blinded().is_some() {
6136
+ HTLCFailReason::reason(INVALID_ONION_BLINDING, vec![0; 32])
6137
+ } else if (error_code & 0x1000) != 0 {
6109
6138
let (real_code, error_data) = self.get_htlc_inbound_temp_fail_err_and_data(error_code, chan);
6110
6139
HTLCFailReason::reason(real_code, error_data)
6111
6140
} else {
0 commit comments