Skip to content

Commit ebcc6f7

Browse files
f move guard clause
1 parent fb2a3c7 commit ebcc6f7

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6603,23 +6603,24 @@ where
66036603
Err(e) => PendingHTLCStatus::Fail(e)
66046604
};
66056605
let create_pending_htlc_status = |chan: &Channel<SP>, pending_forward_info: PendingHTLCStatus, error_code: u16| {
6606+
if msg.blinding_point.is_some() {
6607+
return PendingHTLCStatus::Fail(HTLCFailureMsg::Malformed(
6608+
msgs::UpdateFailMalformedHTLC {
6609+
channel_id: msg.channel_id,
6610+
htlc_id: msg.htlc_id,
6611+
sha256_of_onion: [0; 32],
6612+
failure_code: INVALID_ONION_BLINDING,
6613+
}
6614+
))
6615+
}
66066616
// If the update_add is completely bogus, the call will Err and we will close,
66076617
// but if we've sent a shutdown and they haven't acknowledged it yet, we just
66086618
// want to reject the new HTLC and fail it backwards instead of forwarding.
66096619
match pending_forward_info {
66106620
PendingHTLCStatus::Forward(PendingHTLCInfo {
66116621
ref incoming_shared_secret, ref routing, ..
66126622
}) => {
6613-
let reason = if msg.blinding_point.is_some() {
6614-
return PendingHTLCStatus::Fail(HTLCFailureMsg::Malformed(
6615-
msgs::UpdateFailMalformedHTLC {
6616-
channel_id: msg.channel_id,
6617-
htlc_id: msg.htlc_id,
6618-
sha256_of_onion: [0; 32],
6619-
failure_code: INVALID_ONION_BLINDING,
6620-
}
6621-
))
6622-
} else if routing.blinded_failure().is_some() {
6623+
let reason = if routing.blinded_failure().is_some() {
66236624
HTLCFailReason::reason(INVALID_ONION_BLINDING, vec![0; 32])
66246625
} else if (error_code & 0x1000) != 0 {
66256626
let (real_code, error_data) = self.get_htlc_inbound_temp_fail_err_and_data(error_code, chan);

0 commit comments

Comments
 (0)