@@ -1335,7 +1335,7 @@ macro_rules! remove_channel {
13351335 }
13361336}
13371337
1338- macro_rules! handle_monitor_err {
1338+ macro_rules! handle_monitor_update_res {
13391339 ( $self: ident, $err: expr, $short_to_chan_info: expr, $chan: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr, $resend_channel_ready: expr, $failed_forwards: expr, $failed_fails: expr, $failed_finalized_fulfills: expr, $chan_id: expr) => {
13401340 match $err {
13411341 ChannelMonitorUpdateResult :: PermanentFailure => {
@@ -1383,27 +1383,27 @@ macro_rules! handle_monitor_err {
13831383 }
13841384 } ;
13851385 ( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr, $resend_channel_ready: expr, $failed_forwards: expr, $failed_fails: expr, $failed_finalized_fulfills: expr) => { {
1386- let ( res, drop) = handle_monitor_err !( $self, $err, $channel_state. short_to_chan_info, $entry. get_mut( ) , $action_type, $resend_raa, $resend_commitment, $resend_channel_ready, $failed_forwards, $failed_fails, $failed_finalized_fulfills, $entry. key( ) ) ;
1386+ let ( res, drop) = handle_monitor_update_res !( $self, $err, $channel_state. short_to_chan_info, $entry. get_mut( ) , $action_type, $resend_raa, $resend_commitment, $resend_channel_ready, $failed_forwards, $failed_fails, $failed_finalized_fulfills, $entry. key( ) ) ;
13871387 if drop {
13881388 $entry. remove_entry( ) ;
13891389 }
13901390 res
13911391 } } ;
13921392 ( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $chan_id: expr, COMMITMENT_UPDATE_ONLY ) => { {
13931393 debug_assert!( $action_type == RAACommitmentOrder :: CommitmentFirst ) ;
1394- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, false , true , false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) , $chan_id)
1394+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, false , true , false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) , $chan_id)
13951395 } } ;
13961396 ( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $chan_id: expr, NO_UPDATE ) => {
1397- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, false , false , false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) , $chan_id)
1397+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, false , false , false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) , $chan_id)
13981398 } ;
13991399 ( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_channel_ready: expr, OPTIONALLY_RESEND_FUNDING_LOCKED ) => {
1400- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, false , false , $resend_channel_ready, Vec :: new( ) , Vec :: new( ) , Vec :: new( ) )
1400+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, false , false , $resend_channel_ready, Vec :: new( ) , Vec :: new( ) , Vec :: new( ) )
14011401 } ;
14021402 ( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr) => {
1403- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, $resend_raa, $resend_commitment, false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) )
1403+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, $resend_raa, $resend_commitment, false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) )
14041404 } ;
14051405 ( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr, $failed_forwards: expr, $failed_fails: expr) => {
1406- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, $resend_raa, $resend_commitment, false , $failed_forwards, $failed_fails, Vec :: new( ) )
1406+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, $resend_raa, $resend_commitment, false , $failed_forwards, $failed_fails, Vec :: new( ) )
14071407 } ;
14081408}
14091409
@@ -1491,7 +1491,7 @@ macro_rules! handle_chan_restoration_locked {
14911491 if $raa. is_none( ) {
14921492 order = RAACommitmentOrder :: CommitmentFirst ;
14931493 }
1494- break handle_monitor_err !( $self, e, $channel_state, $channel_entry, order, $raa. is_some( ) , true ) ;
1494+ break handle_monitor_update_res !( $self, e, $channel_state, $channel_entry, order, $raa. is_some( ) , true ) ;
14951495 }
14961496 }
14971497 }
@@ -1846,7 +1846,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
18461846 if let Some ( monitor_update) = monitor_update {
18471847 let update_res = self . chain_monitor . update_channel ( chan_entry. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
18481848 let ( result, is_permanent) =
1849- handle_monitor_err ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
1849+ handle_monitor_update_res ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
18501850 if is_permanent {
18511851 remove_channel ! ( self , channel_state, chan_entry) ;
18521852 break result;
@@ -2468,7 +2468,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
24682468 let update_err = self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
24692469 let chan_id = chan. get ( ) . channel_id ( ) ;
24702470 match ( update_err,
2471- handle_monitor_err ! ( self , update_err, channel_state, chan,
2471+ handle_monitor_update_res ! ( self , update_err, channel_state, chan,
24722472 RAACommitmentOrder :: CommitmentFirst , false , true ) )
24732473 {
24742474 ( ChannelMonitorUpdateResult :: PermanentFailure , Err ( e) ) => break Err ( e) ,
@@ -3290,7 +3290,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
32903290 match self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) {
32913291 ChannelMonitorUpdateResult :: UpdateComplete => { } ,
32923292 e => {
3293- handle_errors. push ( ( chan. get ( ) . get_counterparty_node_id ( ) , handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , true ) ) ) ;
3293+ handle_errors. push ( ( chan. get ( ) . get_counterparty_node_id ( ) , handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , true ) ) ) ;
32943294 continue ;
32953295 }
32963296 }
@@ -3577,7 +3577,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
35773577 Ok ( ( ) )
35783578 } ,
35793579 e => {
3580- let ( res, drop) = handle_monitor_err ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , chan_id, COMMITMENT_UPDATE_ONLY ) ;
3580+ let ( res, drop) = handle_monitor_update_res ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , chan_id, COMMITMENT_UPDATE_ONLY ) ;
35813581 if drop { retain_channel = false ; }
35823582 res
35833583 }
@@ -4207,7 +4207,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
42074207 payment_preimage, e) ;
42084208 return ClaimFundsFromHop :: MonitorUpdateFail (
42094209 chan. get ( ) . get_counterparty_node_id ( ) ,
4210- handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , msgs. is_some( ) ) . unwrap_err ( ) ,
4210+ handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , msgs. is_some( ) ) . unwrap_err ( ) ,
42114211 Some ( htlc_value_msat)
42124212 ) ;
42134213 }
@@ -4689,7 +4689,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
46894689 match self . chain_monitor . watch_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor) {
46904690 ChannelMonitorUpdateResult :: UpdateComplete => { } ,
46914691 e => {
4692- let mut res = handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , channel_ready. is_some( ) , OPTIONALLY_RESEND_FUNDING_LOCKED ) ;
4692+ let mut res = handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , channel_ready. is_some( ) , OPTIONALLY_RESEND_FUNDING_LOCKED ) ;
46934693 if let Err ( MsgHandleErrInternal { ref mut shutdown_finish, .. } ) = res {
46944694 // We weren't able to watch the channel to begin with, so no updates should be made on
46954695 // it. Previously, full_stack_target found an (unreachable) panic when the
@@ -4775,7 +4775,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
47754775 if let Some ( monitor_update) = monitor_update {
47764776 let update_res = self . chain_monitor . update_channel ( chan_entry. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
47774777 let ( result, is_permanent) =
4778- handle_monitor_err ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
4778+ handle_monitor_update_res ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
47794779 if is_permanent {
47804780 remove_channel ! ( self , channel_state, chan_entry) ;
47814781 break result;
@@ -4968,7 +4968,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
49684968 Ok ( res) => res
49694969 } ;
49704970 let update_res = self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
4971- if let Err ( e) = handle_monitor_err ! ( self , update_res, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , true , commitment_signed. is_some( ) ) {
4971+ if let Err ( e) = handle_monitor_update_res ! ( self , update_res, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , true , commitment_signed. is_some( ) ) {
49724972 return Err ( e) ;
49734973 }
49744974
@@ -5057,7 +5057,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
50575057 break Err ( MsgHandleErrInternal :: ignore_no_close ( "Previous monitor update failure prevented responses to RAA" . to_owned ( ) ) ) ;
50585058 }
50595059 if update_res != ChannelMonitorUpdateResult :: UpdateComplete {
5060- if let Err ( e) = handle_monitor_err ! ( self , update_res, channel_state, chan,
5060+ if let Err ( e) = handle_monitor_update_res ! ( self , update_res, channel_state, chan,
50615061 RAACommitmentOrder :: CommitmentFirst , false ,
50625062 raa_updates. commitment_update. is_some( ) , false ,
50635063 raa_updates. accepted_htlcs, raa_updates. failed_htlcs,
@@ -5336,7 +5336,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
53365336 } ,
53375337 e => {
53385338 has_monitor_update = true ;
5339- let ( res, close_channel) = handle_monitor_err ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , channel_id, COMMITMENT_UPDATE_ONLY ) ;
5339+ let ( res, close_channel) = handle_monitor_update_res ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , channel_id, COMMITMENT_UPDATE_ONLY ) ;
53405340 handle_errors. push ( ( chan. get_counterparty_node_id ( ) , res) ) ;
53415341 if close_channel { return false ; }
53425342 } ,
0 commit comments