Skip to content

Commit 02c1b2b

Browse files
committed
f fix lockorder
1 parent b1395b3 commit 02c1b2b

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
@@ -5938,6 +5938,7 @@ where
59385938
}
59395939

59405940
fn handle_monitor_update_release(&self, counterparty_node_id: PublicKey, channel_funding_outpoint: OutPoint) {
5941+
let mut errors = Vec::new();
59415942
loop {
59425943
let per_peer_state = self.per_peer_state.read().unwrap();
59435944
if let Some(peer_state_mtx) = per_peer_state.get(&counterparty_node_id) {
@@ -5953,7 +5954,7 @@ where
59535954
// events be the ones that ultimately release the monitor update(s).
59545955
log_trace!(self.logger, "Delaying monitor unlock for channel {} as another event is pending",
59555956
log_bytes!(&channel_funding_outpoint.to_channel_id()[..]));
5956-
return;
5957+
break;
59575958
}
59585959
if let hash_map::Entry::Occupied(mut chan) = peer_state.channel_by_id.entry(channel_funding_outpoint.to_channel_id()) {
59595960
debug_assert_eq!(chan.get().get_funding_txo().unwrap(), channel_funding_outpoint);
@@ -5962,10 +5963,11 @@ where
59625963
log_bytes!(&channel_funding_outpoint.to_channel_id()[..]));
59635964
let update_res = self.chain_monitor.update_channel(channel_funding_outpoint, monitor_update);
59645965
let update_id = monitor_update.update_id;
5965-
let _ = handle_error!(self,
5966-
handle_new_monitor_update!(self, update_res, update_id,
5967-
peer_state_lck, peer_state, per_peer_state, chan),
5968-
counterparty_node_id);
5966+
if let Err(e) = handle_new_monitor_update!(self, update_res, update_id,
5967+
peer_state_lck, peer_state, per_peer_state, chan)
5968+
{
5969+
errors.push((e, counterparty_node_id));
5970+
}
59695971
if further_update_exists {
59705972
// If there are more `ChannelMonitorUpdate`s to process, restart at the
59715973
// top of the loop.
@@ -5983,6 +5985,10 @@ where
59835985
}
59845986
break;
59855987
}
5988+
for (err, counterparty_node_id) in errors {
5989+
let res = Err::<(), _>(err);
5990+
let _ = handle_error!(self, res, counterparty_node_id);
5991+
}
59865992
}
59875993

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

0 commit comments

Comments
 (0)