Skip to content

Commit 20e8526

Browse files
joostjagerclaude
andcommitted
Rename update_channel_monitor to handle_new_monitor_update_locked_actions_handled_by_caller
The previous name didn't capture that this function is unusual and requires the caller to handle post-update actions manually. The new name makes it clear that callers are responsible for handling locked actions themselves, reducing the risk of misuse. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a160bbf commit 20e8526

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4467,7 +4467,7 @@ where
44674467
log_error!(logger, "Closed channel due to close-required error: {}", msg);
44684468

44694469
if let Some((_, funding_txo, _, update)) = shutdown_res.monitor_update.take() {
4470-
self.update_channel_monitor(
4470+
self.handle_new_monitor_update_locked_actions_handled_by_caller(
44714471
in_flight_monitor_updates,
44724472
chan.context.channel_id(),
44734473
funding_txo,
@@ -9581,7 +9581,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
95819581
/// Returns a tuple of `(update_completed, all_updates_completed)`:
95829582
/// - `update_completed`: whether this specific monitor update finished persisting
95839583
/// - `all_updates_completed`: whether all in-flight updates for this channel are now complete
9584-
fn update_channel_monitor(
9584+
fn handle_new_monitor_update_locked_actions_handled_by_caller(
95859585
&self,
95869586
in_flight_monitor_updates: &mut BTreeMap<ChannelId, (OutPoint, Vec<ChannelMonitorUpdate>)>,
95879587
channel_id: ChannelId, funding_txo: OutPoint, counterparty_node_id: PublicKey,
@@ -9647,13 +9647,14 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
96479647
funding_txo: OutPoint, update: ChannelMonitorUpdate, counterparty_node_id: PublicKey,
96489648
channel_id: ChannelId,
96499649
) -> Option<Vec<MonitorUpdateCompletionAction>> {
9650-
let (_update_completed, all_updates_complete) = self.update_channel_monitor(
9651-
in_flight_monitor_updates,
9652-
channel_id,
9653-
funding_txo,
9654-
counterparty_node_id,
9655-
update,
9656-
);
9650+
let (_update_completed, all_updates_complete) = self
9651+
.handle_new_monitor_update_locked_actions_handled_by_caller(
9652+
in_flight_monitor_updates,
9653+
channel_id,
9654+
funding_txo,
9655+
counterparty_node_id,
9656+
update,
9657+
);
96579658
if all_updates_complete {
96589659
Some(monitor_update_blocked_actions.remove(&channel_id).unwrap_or(Vec::new()))
96599660
} else {
@@ -9767,13 +9768,14 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
97679768
let chan_id = chan.context.channel_id();
97689769
let counterparty_node_id = chan.context.get_counterparty_node_id();
97699770

9770-
let (update_completed, all_updates_complete) = self.update_channel_monitor(
9771-
in_flight_monitor_updates,
9772-
chan_id,
9773-
funding_txo,
9774-
counterparty_node_id,
9775-
update,
9776-
);
9771+
let (update_completed, all_updates_complete) = self
9772+
.handle_new_monitor_update_locked_actions_handled_by_caller(
9773+
in_flight_monitor_updates,
9774+
chan_id,
9775+
funding_txo,
9776+
counterparty_node_id,
9777+
update,
9778+
);
97779779

97789780
let completion_data = if all_updates_complete {
97799781
Some(self.try_resume_channel_post_monitor_update(
@@ -14993,7 +14995,7 @@ where
1499314995
insert_short_channel_id!(short_to_chan_info, funded_channel);
1499414996

1499514997
if let Some(monitor_update) = monitor_update_opt {
14996-
self.update_channel_monitor(
14998+
self.handle_new_monitor_update_locked_actions_handled_by_caller(
1499714999
&mut peer_state.in_flight_monitor_updates,
1499815000
funded_channel.context.channel_id(),
1499915001
funding_txo,

0 commit comments

Comments
 (0)