@@ -5938,6 +5938,7 @@ where
5938
5938
}
5939
5939
5940
5940
fn handle_monitor_update_release ( & self , counterparty_node_id : PublicKey , channel_funding_outpoint : OutPoint ) {
5941
+ let mut errors = Vec :: new ( ) ;
5941
5942
loop {
5942
5943
let per_peer_state = self . per_peer_state . read ( ) . unwrap ( ) ;
5943
5944
if let Some ( peer_state_mtx) = per_peer_state. get ( & counterparty_node_id) {
@@ -5953,7 +5954,7 @@ where
5953
5954
// events be the ones that ultimately release the monitor update(s).
5954
5955
log_trace ! ( self . logger, "Delaying monitor unlock for channel {} as another event is pending" ,
5955
5956
log_bytes!( & channel_funding_outpoint. to_channel_id( ) [ ..] ) ) ;
5956
- return ;
5957
+ break ;
5957
5958
}
5958
5959
if let hash_map:: Entry :: Occupied ( mut chan) = peer_state. channel_by_id . entry ( channel_funding_outpoint. to_channel_id ( ) ) {
5959
5960
debug_assert_eq ! ( chan. get( ) . get_funding_txo( ) . unwrap( ) , channel_funding_outpoint) ;
@@ -5962,10 +5963,11 @@ where
5962
5963
log_bytes!( & channel_funding_outpoint. to_channel_id( ) [ ..] ) ) ;
5963
5964
let update_res = self . chain_monitor . update_channel ( channel_funding_outpoint, monitor_update) ;
5964
5965
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
+ }
5969
5971
if further_update_exists {
5970
5972
// If there are more `ChannelMonitorUpdate`s to process, restart at the
5971
5973
// top of the loop.
@@ -5983,6 +5985,10 @@ where
5983
5985
}
5984
5986
break ;
5985
5987
}
5988
+ for ( err, counterparty_node_id) in errors {
5989
+ let res = Err :: < ( ) , _ > ( err) ;
5990
+ let _ = handle_error ! ( self , res, counterparty_node_id) ;
5991
+ }
5986
5992
}
5987
5993
5988
5994
fn handle_post_event_actions ( & self , actions : Vec < EventCompletionAction > ) {
0 commit comments