@@ -1335,7 +1335,7 @@ macro_rules! remove_channel {
1335
1335
}
1336
1336
}
1337
1337
1338
- macro_rules! handle_monitor_err {
1338
+ macro_rules! handle_monitor_update_res {
1339
1339
( $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) => {
1340
1340
match $err {
1341
1341
ChannelMonitorUpdateStatus :: PermanentFailure => {
@@ -1383,27 +1383,27 @@ macro_rules! handle_monitor_err {
1383
1383
}
1384
1384
} ;
1385
1385
( $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( ) ) ;
1387
1387
if drop {
1388
1388
$entry. remove_entry( ) ;
1389
1389
}
1390
1390
res
1391
1391
} } ;
1392
1392
( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $chan_id: expr, COMMITMENT_UPDATE_ONLY ) => { {
1393
1393
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)
1395
1395
} } ;
1396
1396
( $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)
1398
1398
} ;
1399
1399
( $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( ) )
1401
1401
} ;
1402
1402
( $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( ) )
1404
1404
} ;
1405
1405
( $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( ) )
1407
1407
} ;
1408
1408
}
1409
1409
@@ -1491,7 +1491,7 @@ macro_rules! handle_chan_restoration_locked {
1491
1491
if $raa. is_none( ) {
1492
1492
order = RAACommitmentOrder :: CommitmentFirst ;
1493
1493
}
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 ) ;
1495
1495
}
1496
1496
}
1497
1497
}
@@ -1846,7 +1846,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
1846
1846
if let Some ( monitor_update) = monitor_update {
1847
1847
let update_res = self . chain_monitor . update_channel ( chan_entry. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
1848
1848
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 ) ;
1850
1850
if is_permanent {
1851
1851
remove_channel ! ( self , channel_state, chan_entry) ;
1852
1852
break result;
@@ -2468,7 +2468,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2468
2468
let update_err = self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
2469
2469
let chan_id = chan. get ( ) . channel_id ( ) ;
2470
2470
match ( update_err,
2471
- handle_monitor_err ! ( self , update_err, channel_state, chan,
2471
+ handle_monitor_update_res ! ( self , update_err, channel_state, chan,
2472
2472
RAACommitmentOrder :: CommitmentFirst , false , true ) )
2473
2473
{
2474
2474
( ChannelMonitorUpdateStatus :: PermanentFailure , Err ( e) ) => break Err ( e) ,
@@ -3290,7 +3290,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3290
3290
match self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) {
3291
3291
ChannelMonitorUpdateStatus :: Complete => { } ,
3292
3292
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 ) ) ) ;
3294
3294
continue ;
3295
3295
}
3296
3296
}
@@ -3577,7 +3577,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3577
3577
Ok ( ( ) )
3578
3578
} ,
3579
3579
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 ) ;
3581
3581
if drop { retain_channel = false ; }
3582
3582
res
3583
3583
}
@@ -4207,7 +4207,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4207
4207
payment_preimage, e) ;
4208
4208
return ClaimFundsFromHop :: MonitorUpdateFail (
4209
4209
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 ( ) ,
4211
4211
Some ( htlc_value_msat)
4212
4212
) ;
4213
4213
}
@@ -4689,7 +4689,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4689
4689
match self . chain_monitor . watch_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor) {
4690
4690
ChannelMonitorUpdateStatus :: Complete => { } ,
4691
4691
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 ) ;
4693
4693
if let Err ( MsgHandleErrInternal { ref mut shutdown_finish, .. } ) = res {
4694
4694
// We weren't able to watch the channel to begin with, so no updates should be made on
4695
4695
// 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
4775
4775
if let Some ( monitor_update) = monitor_update {
4776
4776
let update_res = self . chain_monitor . update_channel ( chan_entry. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
4777
4777
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 ) ;
4779
4779
if is_permanent {
4780
4780
remove_channel ! ( self , channel_state, chan_entry) ;
4781
4781
break result;
@@ -4968,7 +4968,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4968
4968
Ok ( res) => res
4969
4969
} ;
4970
4970
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( ) ) {
4972
4972
return Err ( e) ;
4973
4973
}
4974
4974
@@ -5057,7 +5057,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
5057
5057
break Err ( MsgHandleErrInternal :: ignore_no_close ( "Existing pending monitor update prevented responses to RAA" . to_owned ( ) ) ) ;
5058
5058
}
5059
5059
if update_res != ChannelMonitorUpdateStatus :: Complete {
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,
5061
5061
RAACommitmentOrder :: CommitmentFirst , false ,
5062
5062
raa_updates. commitment_update. is_some( ) , false ,
5063
5063
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
5336
5336
} ,
5337
5337
e => {
5338
5338
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 ) ;
5340
5340
handle_errors. push ( ( chan. get_counterparty_node_id ( ) , res) ) ;
5341
5341
if close_channel { return false ; }
5342
5342
} ,
0 commit comments