@@ -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
ChannelMonitorUpdateResult :: 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;
@@ -2470,7 +2470,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2470
2470
let update_err = self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
2471
2471
let chan_id = chan. get ( ) . channel_id ( ) ;
2472
2472
match ( update_err,
2473
- handle_monitor_err ! ( self , update_err, channel_state, chan,
2473
+ handle_monitor_update_res ! ( self , update_err, channel_state, chan,
2474
2474
RAACommitmentOrder :: CommitmentFirst , false , true ) )
2475
2475
{
2476
2476
( ChannelMonitorUpdateResult :: PermanentFailure , Err ( e) ) => break Err ( e) ,
@@ -3270,7 +3270,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3270
3270
match self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) {
3271
3271
ChannelMonitorUpdateResult :: UpdateComplete => { } ,
3272
3272
e => {
3273
- handle_errors. push ( ( chan. get ( ) . get_counterparty_node_id ( ) , handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , true ) ) ) ;
3273
+ handle_errors. push ( ( chan. get ( ) . get_counterparty_node_id ( ) , handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , true ) ) ) ;
3274
3274
continue ;
3275
3275
}
3276
3276
}
@@ -3556,7 +3556,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3556
3556
Ok ( ( ) )
3557
3557
} ,
3558
3558
e => {
3559
- let ( res, drop) = handle_monitor_err ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , chan_id, COMMITMENT_UPDATE_ONLY ) ;
3559
+ let ( res, drop) = handle_monitor_update_res ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , chan_id, COMMITMENT_UPDATE_ONLY ) ;
3560
3560
if drop { retain_channel = false ; }
3561
3561
res
3562
3562
}
@@ -4177,7 +4177,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4177
4177
payment_preimage, e) ;
4178
4178
return ClaimFundsFromHop :: MonitorUpdateFail (
4179
4179
chan. get ( ) . get_counterparty_node_id ( ) ,
4180
- handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , msgs. is_some( ) ) . unwrap_err ( ) ,
4180
+ handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , msgs. is_some( ) ) . unwrap_err ( ) ,
4181
4181
Some ( htlc_value_msat)
4182
4182
) ;
4183
4183
}
@@ -4656,7 +4656,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4656
4656
match self . chain_monitor . watch_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor) {
4657
4657
ChannelMonitorUpdateResult :: UpdateComplete => { } ,
4658
4658
e => {
4659
- let mut res = handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , channel_ready. is_some( ) , OPTIONALLY_RESEND_FUNDING_LOCKED ) ;
4659
+ let mut res = handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , channel_ready. is_some( ) , OPTIONALLY_RESEND_FUNDING_LOCKED ) ;
4660
4660
if let Err ( MsgHandleErrInternal { ref mut shutdown_finish, .. } ) = res {
4661
4661
// We weren't able to watch the channel to begin with, so no updates should be made on
4662
4662
// it. Previously, full_stack_target found an (unreachable) panic when the
@@ -4742,7 +4742,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4742
4742
if let Some ( monitor_update) = monitor_update {
4743
4743
let update_res = self . chain_monitor . update_channel ( chan_entry. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
4744
4744
let ( result, is_permanent) =
4745
- handle_monitor_err ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
4745
+ handle_monitor_update_res ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
4746
4746
if is_permanent {
4747
4747
remove_channel ! ( self , channel_state, chan_entry) ;
4748
4748
break result;
@@ -4933,7 +4933,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4933
4933
Ok ( res) => res
4934
4934
} ;
4935
4935
let update_res = self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
4936
- if let Err ( e) = handle_monitor_err ! ( self , update_res, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , true , commitment_signed. is_some( ) ) {
4936
+ if let Err ( e) = handle_monitor_update_res ! ( self , update_res, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , true , commitment_signed. is_some( ) ) {
4937
4937
return Err ( e) ;
4938
4938
}
4939
4939
@@ -5022,7 +5022,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
5022
5022
break Err ( MsgHandleErrInternal :: ignore_no_close ( "Previous monitor update failure prevented responses to RAA" . to_owned ( ) ) ) ;
5023
5023
}
5024
5024
if update_res != ChannelMonitorUpdateResult :: UpdateComplete {
5025
- if let Err ( e) = handle_monitor_err ! ( self , update_res, channel_state, chan,
5025
+ if let Err ( e) = handle_monitor_update_res ! ( self , update_res, channel_state, chan,
5026
5026
RAACommitmentOrder :: CommitmentFirst , false ,
5027
5027
raa_updates. commitment_update. is_some( ) , false ,
5028
5028
raa_updates. accepted_htlcs, raa_updates. failed_htlcs,
@@ -5299,7 +5299,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
5299
5299
} ,
5300
5300
e => {
5301
5301
has_monitor_update = true ;
5302
- let ( res, close_channel) = handle_monitor_err ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , channel_id, COMMITMENT_UPDATE_ONLY ) ;
5302
+ let ( res, close_channel) = handle_monitor_update_res ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , channel_id, COMMITMENT_UPDATE_ONLY ) ;
5303
5303
handle_errors. push ( ( chan. get_counterparty_node_id ( ) , res) ) ;
5304
5304
if close_channel { return false ; }
5305
5305
} ,
0 commit comments