Skip to content

Commit 666a7dd

Browse files
committed
f fix lockorder
1 parent 110f9c2 commit 666a7dd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5853,6 +5853,7 @@ where
58535853
}
58545854

58555855
fn handle_monitor_update_release(&self, counterparty_node_id: PublicKey, channel_funding_outpoint: OutPoint) {
5856+
let mut errors = Vec::new();
58565857
loop {
58575858
let per_peer_state = self.per_peer_state.read().unwrap();
58585859
if let Some(peer_state_mtx) = per_peer_state.get(&counterparty_node_id) {
@@ -5868,7 +5869,7 @@ where
58685869
// events be the ones that ultimately release the monitor update(s).
58695870
log_trace!(self.logger, "Delaying monitor unlock for channel {} as another event is pending",
58705871
log_bytes!(&channel_funding_outpoint.to_channel_id()[..]));
5871-
return;
5872+
break;
58725873
}
58735874
if let hash_map::Entry::Occupied(mut chan) = peer_state.channel_by_id.entry(channel_funding_outpoint.to_channel_id()) {
58745875
debug_assert_eq!(chan.get().get_funding_txo().unwrap(), channel_funding_outpoint);
@@ -5877,10 +5878,11 @@ where
58775878
log_bytes!(&channel_funding_outpoint.to_channel_id()[..]));
58785879
let update_res = self.chain_monitor.update_channel(channel_funding_outpoint, monitor_update);
58795880
let update_id = monitor_update.update_id;
5880-
let _ = handle_error!(self,
5881-
handle_new_monitor_update!(self, update_res, update_id,
5882-
peer_state_lck, peer_state, per_peer_state, chan),
5883-
counterparty_node_id);
5881+
if let Err(e) = handle_new_monitor_update!(self, update_res, update_id,
5882+
peer_state_lck, peer_state, per_peer_state, chan)
5883+
{
5884+
errors.push((e, counterparty_node_id));
5885+
}
58845886
if further_update_exists {
58855887
// If there are more `ChannelMonitorUpdate`s to process, restart at the
58865888
// top of the loop.
@@ -5898,6 +5900,10 @@ where
58985900
}
58995901
break;
59005902
}
5903+
for (err, counterparty_node_id) in errors {
5904+
let res = Err::<(), _>(err);
5905+
let _ = handle_error!(self, res, counterparty_node_id);
5906+
}
59015907
}
59025908

59035909
fn handle_post_event_actions(&self, actions: Vec<EventCompletionAction>) {

0 commit comments

Comments
 (0)