Skip to content

Commit 1472ffc

Browse files
committed
Remove the blocked param on ChannelMonitorUpdates in Channel
Now that all `ChannelMonitorUpdate`s stored in `Channel` are blocked we don't need a bool to track it.
1 parent 6567b67 commit 1472ffc

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

lightning/src/ln/channel.rs

+2-15
Original file line numberDiff line numberDiff line change
@@ -585,17 +585,10 @@ pub(crate) const DISCONNECT_PEER_AWAITING_RESPONSE_TICKS: usize = 2;
585585

586586
struct PendingChannelMonitorUpdate {
587587
update: ChannelMonitorUpdate,
588-
/// In some cases we need to delay letting the [`ChannelMonitorUpdate`] go until after an
589-
/// `Event` is processed by the user. This bool indicates the [`ChannelMonitorUpdate`] is
590-
/// blocked on some external event and the [`ChannelManager`] will update us when we're ready.
591-
///
592-
/// [`ChannelManager`]: super::channelmanager::ChannelManager
593-
blocked: bool,
594588
}
595589

596590
impl_writeable_tlv_based!(PendingChannelMonitorUpdate, {
597591
(0, update, required),
598-
(2, blocked, required),
599592
});
600593

601594
/// Contains everything about the channel including state, and various flags.
@@ -2286,7 +2279,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
22862279
debug_assert!(false, "If there is a pending blocked monitor we should have MonitorUpdateInProgress set");
22872280
let update = self.build_commitment_no_status_check(logger);
22882281
self.context.pending_monitor_updates.push(PendingChannelMonitorUpdate {
2289-
update, blocked: true,
2282+
update,
22902283
});
22912284
}
22922285
}
@@ -3546,9 +3539,6 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
35463539
{
35473540
assert_eq!(self.context.channel_state & ChannelState::MonitorUpdateInProgress as u32, ChannelState::MonitorUpdateInProgress as u32);
35483541
self.context.channel_state &= !(ChannelState::MonitorUpdateInProgress as u32);
3549-
for upd in self.context.pending_monitor_updates.iter() {
3550-
debug_assert!(upd.blocked);
3551-
}
35523542

35533543
// If we're past (or at) the FundingSent stage on an outbound channel, try to
35543544
// (re-)broadcast the funding transaction as we may have declined to broadcast it when we
@@ -4415,9 +4405,6 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
44154405
/// Returns the next blocked monitor update, if one exists, and a bool which indicates a
44164406
/// further blocked monitor update exists after the next.
44174407
pub fn unblock_next_blocked_monitor_update(&mut self) -> Option<(ChannelMonitorUpdate, bool)> {
4418-
for upd in self.context.pending_monitor_updates.iter() {
4419-
debug_assert!(upd.blocked);
4420-
}
44214408
if self.context.pending_monitor_updates.is_empty() { return None; }
44224409
Some((self.context.pending_monitor_updates.remove(0).update,
44234410
!self.context.pending_monitor_updates.is_empty()))
@@ -4430,7 +4417,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
44304417
let release_monitor = self.context.pending_monitor_updates.is_empty();
44314418
if !release_monitor {
44324419
self.context.pending_monitor_updates.push(PendingChannelMonitorUpdate {
4433-
update, blocked: true,
4420+
update,
44344421
});
44354422
None
44364423
} else {

0 commit comments

Comments
 (0)