@@ -1048,7 +1048,7 @@ enum UpdateFulfillFetch {
1048
1048
NewClaim {
1049
1049
monitor_update: ChannelMonitorUpdate,
1050
1050
htlc_value_msat: u64,
1051
- msg: Option<msgs::UpdateFulfillHTLC> ,
1051
+ update_blocked: bool ,
1052
1052
},
1053
1053
DuplicateClaim {},
1054
1054
}
@@ -5388,8 +5388,8 @@ impl<SP: Deref> FundedChannel<SP> where
5388
5388
let mon_update_id = self.context.latest_monitor_update_id; // Forget the ChannelMonitor update
5389
5389
let fulfill_resp = self.get_update_fulfill_htlc(htlc_id_arg, payment_preimage_arg, None, logger);
5390
5390
self.context.latest_monitor_update_id = mon_update_id;
5391
- if let UpdateFulfillFetch::NewClaim { msg , .. } = fulfill_resp {
5392
- assert!(msg.is_none() ); // The HTLC must have ended up in the holding cell.
5391
+ if let UpdateFulfillFetch::NewClaim { update_blocked , .. } = fulfill_resp {
5392
+ assert!(update_blocked ); // The HTLC must have ended up in the holding cell.
5393
5393
}
5394
5394
}
5395
5395
@@ -5476,7 +5476,7 @@ impl<SP: Deref> FundedChannel<SP> where
5476
5476
// TODO: We may actually be able to switch to a fulfill here, though its
5477
5477
// rare enough it may not be worth the complexity burden.
5478
5478
debug_assert!(false, "Tried to fulfill an HTLC that was already failed");
5479
- return UpdateFulfillFetch::NewClaim { monitor_update, htlc_value_msat, msg: None };
5479
+ return UpdateFulfillFetch::NewClaim { monitor_update, htlc_value_msat, update_blocked: true };
5480
5480
}
5481
5481
},
5482
5482
_ => {}
@@ -5486,15 +5486,15 @@ impl<SP: Deref> FundedChannel<SP> where
5486
5486
self.context.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::ClaimHTLC {
5487
5487
payment_preimage: payment_preimage_arg, htlc_id: htlc_id_arg,
5488
5488
});
5489
- return UpdateFulfillFetch::NewClaim { monitor_update, htlc_value_msat, msg: None };
5489
+ return UpdateFulfillFetch::NewClaim { monitor_update, htlc_value_msat, update_blocked: true };
5490
5490
}
5491
5491
5492
5492
{
5493
5493
let htlc = &mut self.context.pending_inbound_htlcs[pending_idx];
5494
5494
if let InboundHTLCState::Committed = htlc.state {
5495
5495
} else {
5496
5496
debug_assert!(false, "Have an inbound HTLC we tried to claim before it was fully committed to");
5497
- return UpdateFulfillFetch::NewClaim { monitor_update, htlc_value_msat, msg: None };
5497
+ return UpdateFulfillFetch::NewClaim { monitor_update, htlc_value_msat, update_blocked: true };
5498
5498
}
5499
5499
log_trace!(logger, "Upgrading HTLC {} to LocalRemoved with a Fulfill in channel {}!", &htlc.payment_hash, &self.context.channel_id);
5500
5500
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(payment_preimage_arg.clone()));
@@ -5503,11 +5503,7 @@ impl<SP: Deref> FundedChannel<SP> where
5503
5503
UpdateFulfillFetch::NewClaim {
5504
5504
monitor_update,
5505
5505
htlc_value_msat,
5506
- msg: Some(msgs::UpdateFulfillHTLC {
5507
- channel_id: self.context.channel_id(),
5508
- htlc_id: htlc_id_arg,
5509
- payment_preimage: payment_preimage_arg,
5510
- }),
5506
+ update_blocked: false,
5511
5507
}
5512
5508
}
5513
5509
@@ -5517,13 +5513,13 @@ impl<SP: Deref> FundedChannel<SP> where
5517
5513
) -> UpdateFulfillCommitFetch where L::Target: Logger {
5518
5514
let release_cs_monitor = self.context.blocked_monitor_updates.is_empty();
5519
5515
match self.get_update_fulfill_htlc(htlc_id, payment_preimage, payment_info, logger) {
5520
- UpdateFulfillFetch::NewClaim { mut monitor_update, htlc_value_msat, msg } => {
5516
+ UpdateFulfillFetch::NewClaim { mut monitor_update, htlc_value_msat, update_blocked } => {
5521
5517
// Even if we aren't supposed to let new monitor updates with commitment state
5522
5518
// updates run, we still need to push the preimage ChannelMonitorUpdateStep no
5523
5519
// matter what. Sadly, to push a new monitor update which flies before others
5524
5520
// already queued, we have to insert it into the pending queue and update the
5525
5521
// update_ids of all the following monitors.
5526
- if release_cs_monitor && msg.is_some() {
5522
+ if release_cs_monitor && !update_blocked {
5527
5523
let mut additional_update = self.build_commitment_no_status_check(logger);
5528
5524
// build_commitment_no_status_check may bump latest_monitor_id but we want them
5529
5525
// to be strictly increasing by one, so decrement it here.
@@ -5536,7 +5532,7 @@ impl<SP: Deref> FundedChannel<SP> where
5536
5532
for held_update in self.context.blocked_monitor_updates.iter_mut() {
5537
5533
held_update.update.update_id += 1;
5538
5534
}
5539
- if msg.is_some() {
5535
+ if !update_blocked {
5540
5536
debug_assert!(false, "If there is a pending blocked monitor we should have MonitorUpdateInProgress set");
5541
5537
let update = self.build_commitment_no_status_check(logger);
5542
5538
self.context.blocked_monitor_updates.push(PendingChannelMonitorUpdate {
@@ -5545,7 +5541,7 @@ impl<SP: Deref> FundedChannel<SP> where
5545
5541
}
5546
5542
}
5547
5543
5548
- self.monitor_updating_paused(false, msg.is_some() , false, Vec::new(), Vec::new(), Vec::new());
5544
+ self.monitor_updating_paused(false, !update_blocked , false, Vec::new(), Vec::new(), Vec::new());
5549
5545
UpdateFulfillCommitFetch::NewClaim { monitor_update, htlc_value_msat, }
5550
5546
},
5551
5547
UpdateFulfillFetch::DuplicateClaim {} => UpdateFulfillCommitFetch::DuplicateClaim {},
0 commit comments