@@ -5853,6 +5853,7 @@ where
5853
5853
}
5854
5854
5855
5855
fn handle_monitor_update_release ( & self , counterparty_node_id : PublicKey , channel_funding_outpoint : OutPoint ) {
5856
+ let mut errors = Vec :: new ( ) ;
5856
5857
loop {
5857
5858
let per_peer_state = self . per_peer_state . read ( ) . unwrap ( ) ;
5858
5859
if let Some ( peer_state_mtx) = per_peer_state. get ( & counterparty_node_id) {
@@ -5868,7 +5869,7 @@ where
5868
5869
// events be the ones that ultimately release the monitor update(s).
5869
5870
log_trace ! ( self . logger, "Delaying monitor unlock for channel {} as another event is pending" ,
5870
5871
log_bytes!( & channel_funding_outpoint. to_channel_id( ) [ ..] ) ) ;
5871
- return ;
5872
+ break ;
5872
5873
}
5873
5874
if let hash_map:: Entry :: Occupied ( mut chan) = peer_state. channel_by_id . entry ( channel_funding_outpoint. to_channel_id ( ) ) {
5874
5875
debug_assert_eq ! ( chan. get( ) . get_funding_txo( ) . unwrap( ) , channel_funding_outpoint) ;
@@ -5877,10 +5878,11 @@ where
5877
5878
log_bytes!( & channel_funding_outpoint. to_channel_id( ) [ ..] ) ) ;
5878
5879
let update_res = self . chain_monitor . update_channel ( channel_funding_outpoint, monitor_update) ;
5879
5880
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
+ }
5884
5886
if further_update_exists {
5885
5887
// If there are more `ChannelMonitorUpdate`s to process, restart at the
5886
5888
// top of the loop.
@@ -5898,6 +5900,10 @@ where
5898
5900
}
5899
5901
break ;
5900
5902
}
5903
+ for ( err, counterparty_node_id) in errors {
5904
+ let res = Err :: < ( ) , _ > ( err) ;
5905
+ let _ = handle_error ! ( self , res, counterparty_node_id) ;
5906
+ }
5901
5907
}
5902
5908
5903
5909
fn handle_post_event_actions ( & self , actions : Vec < EventCompletionAction > ) {
0 commit comments