Skip to content

Commit d0d1634

Browse files
Clean up code DRY'd in previous commit.
1 parent 2917666 commit d0d1634

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

lightning/src/ln/channel.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3629,23 +3629,22 @@ impl<SP: Deref> Channel<SP> where
36293629
.map(|fail_msg_opt| fail_msg_opt.map(|_| ())))
36303630
}
36313631
};
3632-
match fail_htlc_res {
3633-
Some(Ok(fail_msg_opt)) => {
3634-
// If an HTLC failure was previously added to the holding cell (via
3635-
// `queue_fail_{malformed_}htlc`) then generating the fail message itself must
3636-
// not fail - we should never end up in a state where we double-fail
3637-
// an HTLC or fail-then-claim an HTLC as it indicates we didn't wait
3638-
// for a full revocation before failing.
3639-
debug_assert!(fail_msg_opt.is_some());
3640-
update_fail_count += 1;
3641-
},
3642-
Some(Err(e)) => {
3643-
if let ChannelError::Ignore(_) = e {}
3644-
else {
3632+
if let Some(res) = fail_htlc_res {
3633+
match res {
3634+
Ok(fail_msg_opt) => {
3635+
// If an HTLC failure was previously added to the holding cell (via
3636+
// `queue_fail_{malformed_}htlc`) then generating the fail message itself must
3637+
// not fail - we should never end up in a state where we double-fail
3638+
// an HTLC or fail-then-claim an HTLC as it indicates we didn't wait
3639+
// for a full revocation before failing.
3640+
debug_assert!(fail_msg_opt.is_some());
3641+
update_fail_count += 1;
3642+
},
3643+
Err(ChannelError::Ignore(_)) => {},
3644+
Err(_) => {
36453645
panic!("Got a non-IgnoreError action trying to fail holding cell HTLC");
3646-
}
3647-
},
3648-
None => {}
3646+
},
3647+
}
36493648
}
36503649
}
36513650
if update_add_count == 0 && update_fulfill_count == 0 && update_fail_count == 0 && self.context.holding_cell_update_fee.is_none() {

0 commit comments

Comments
 (0)