Skip to content

Commit 7884e68

Browse files
committed
Rename Channel's latest-monitor-update fetch method for clarity
`Channel::get_latest_complete_monitor_update_id` no longer refers to complete updates, but rather ones which were passed to the `ChannelManager` and which the `CHannel` no longer knows about. Thus, we rename it `get_latest_unblocked_monitor_update_id`.
1 parent 60e671b commit 7884e68

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lightning/src/ln/channel.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4404,7 +4404,8 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
44044404
(self.context.channel_state & ChannelState::MonitorUpdateInProgress as u32) != 0
44054405
}
44064406

4407-
pub fn get_latest_complete_monitor_update_id(&self) -> u64 {
4407+
/// Gets the latest [`ChannelMonitorUpdate`] ID which has been released and is in-flight.
4408+
pub fn get_latest_unblocked_monitor_update_id(&self) -> u64 {
44084409
if self.context.pending_monitor_updates.is_empty() { return self.context.get_latest_monitor_update_id(); }
44094410
self.context.pending_monitor_updates[0].update.update_id - 1
44104411
}

lightning/src/ln/channelmanager.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8441,12 +8441,12 @@ where
84418441
funding_txo, monitor, peer_state, ""));
84428442
}
84438443
}
8444-
if chan.get_latest_complete_monitor_update_id() > max_in_flight_update_id {
8444+
if chan.get_latest_unblocked_monitor_update_id() > max_in_flight_update_id {
84458445
// If the channel is ahead of the monitor, return InvalidValue:
84468446
log_error!(args.logger, "A ChannelMonitor is stale compared to the current ChannelManager! This indicates a potentially-critical violation of the chain::Watch API!");
84478447
log_error!(args.logger, " The ChannelMonitor for channel {} is at update_id {} with update_id through {} in-flight",
84488448
log_bytes!(chan.context.channel_id()), monitor.get_latest_update_id(), max_in_flight_update_id);
8449-
log_error!(args.logger, " but the ChannelManager is at update_id {}.", chan.get_latest_complete_monitor_update_id());
8449+
log_error!(args.logger, " but the ChannelManager is at update_id {}.", chan.get_latest_unblocked_monitor_update_id());
84508450
log_error!(args.logger, " The chain::Watch API *requires* that monitors are persisted durably before returning,");
84518451
log_error!(args.logger, " client applications must ensure that ChannelMonitor data is always available and the latest to avoid funds loss!");
84528452
log_error!(args.logger, " Without the latest ChannelMonitor we cannot continue without risking funds.");

0 commit comments

Comments
 (0)