@@ -3576,7 +3576,7 @@ impl<SP: Deref> Channel<SP> where
3576
3576
// the limit. In case it's less rare than I anticipate, we may want to revisit
3577
3577
// handling this case better and maybe fulfilling some of the HTLCs while attempting
3578
3578
// to rebalance channels.
3579
- match &htlc_update {
3579
+ let fail_htlc_res = match &htlc_update {
3580
3580
&HTLCUpdateAwaitingACK::AddHTLC {
3581
3581
amount_msat, cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet,
3582
3582
skimmed_fee_msat, blinding_point, ..
@@ -3604,6 +3604,7 @@ impl<SP: Deref> Channel<SP> where
3604
3604
}
3605
3605
}
3606
3606
}
3607
+ None
3607
3608
},
3608
3609
&HTLCUpdateAwaitingACK::ClaimHTLC { ref payment_preimage, htlc_id, .. } => {
3609
3610
// If an HTLC claim was previously added to the holding cell (via
@@ -3617,40 +3618,34 @@ impl<SP: Deref> Channel<SP> where
3617
3618
{ monitor_update } else { unreachable!() };
3618
3619
update_fulfill_count += 1;
3619
3620
monitor_update.updates.append(&mut additional_monitor_update.updates);
3621
+ None
3620
3622
},
3621
3623
&HTLCUpdateAwaitingACK::FailHTLC { htlc_id, ref err_packet } => {
3622
- match self.fail_htlc(htlc_id, err_packet.clone(), false, logger) {
3623
- Ok(update_fail_msg_option) => {
3624
- // If an HTLC failure was previously added to the holding cell (via
3625
- // `queue_fail_htlc`) then generating the fail message itself must
3626
- // not fail - we should never end up in a state where we double-fail
3627
- // an HTLC or fail-then-claim an HTLC as it indicates we didn't wait
3628
- // for a full revocation before failing.
3629
- debug_assert!(update_fail_msg_option.is_some());
3630
- update_fail_count += 1;
3631
- },
3632
- Err(e) => {
3633
- if let ChannelError::Ignore(_) = e {}
3634
- else {
3635
- panic!("Got a non-IgnoreError action trying to fail holding cell HTLC");
3636
- }
3637
- }
3638
- }
3624
+ Some(self.fail_htlc(htlc_id, err_packet.clone(), false, logger)
3625
+ .map(|fail_msg_opt| fail_msg_opt.map(|_| ())))
3639
3626
},
3640
3627
&HTLCUpdateAwaitingACK::FailMalformedHTLC { htlc_id, failure_code, sha256_of_onion } => {
3641
- match self.fail_htlc(htlc_id, (failure_code, sha256_of_onion), false, logger) {
3642
- Ok(update_fail_malformed_opt) => {
3643
- debug_assert!(update_fail_malformed_opt.is_some()); // See above comment
3644
- update_fail_count += 1;
3645
- },
3646
- Err(e) => {
3647
- if let ChannelError::Ignore(_) = e {}
3648
- else {
3649
- panic!("Got a non-IgnoreError action trying to fail holding cell HTLC");
3650
- }
3651
- }
3628
+ Some(self.fail_htlc(htlc_id, (failure_code, sha256_of_onion), false, logger)
3629
+ .map(|fail_msg_opt| fail_msg_opt.map(|_| ())))
3630
+ }
3631
+ };
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 {
3645
+ panic!("Got a non-IgnoreError action trying to fail holding cell HTLC");
3652
3646
}
3653
3647
},
3648
+ None => {}
3654
3649
}
3655
3650
}
3656
3651
if update_add_count == 0 && update_fulfill_count == 0 && update_fail_count == 0 && self.context.holding_cell_update_fee.is_none() {
0 commit comments