@@ -1329,7 +1329,7 @@ macro_rules! remove_channel {
1329
1329
}
1330
1330
}
1331
1331
1332
- macro_rules! handle_monitor_err {
1332
+ macro_rules! handle_monitor_update_res {
1333
1333
( $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) => {
1334
1334
match $err {
1335
1335
ChannelMonitorUpdateStatus :: PermanentFailure => {
@@ -1377,27 +1377,27 @@ macro_rules! handle_monitor_err {
1377
1377
}
1378
1378
} ;
1379
1379
( $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) => { {
1380
- 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( ) ) ;
1380
+ 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( ) ) ;
1381
1381
if drop {
1382
1382
$entry. remove_entry( ) ;
1383
1383
}
1384
1384
res
1385
1385
} } ;
1386
1386
( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $chan_id: expr, COMMITMENT_UPDATE_ONLY ) => { {
1387
1387
debug_assert!( $action_type == RAACommitmentOrder :: CommitmentFirst ) ;
1388
- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, false , true , false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) , $chan_id)
1388
+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, false , true , false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) , $chan_id)
1389
1389
} } ;
1390
1390
( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $chan_id: expr, NO_UPDATE ) => {
1391
- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, false , false , false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) , $chan_id)
1391
+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, false , false , false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) , $chan_id)
1392
1392
} ;
1393
1393
( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_channel_ready: expr, OPTIONALLY_RESEND_FUNDING_LOCKED ) => {
1394
- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, false , false , $resend_channel_ready, Vec :: new( ) , Vec :: new( ) , Vec :: new( ) )
1394
+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, false , false , $resend_channel_ready, Vec :: new( ) , Vec :: new( ) , Vec :: new( ) )
1395
1395
} ;
1396
1396
( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr) => {
1397
- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, $resend_raa, $resend_commitment, false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) )
1397
+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, $resend_raa, $resend_commitment, false , Vec :: new( ) , Vec :: new( ) , Vec :: new( ) )
1398
1398
} ;
1399
1399
( $self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr, $failed_forwards: expr, $failed_fails: expr) => {
1400
- handle_monitor_err !( $self, $err, $channel_state, $entry, $action_type, $resend_raa, $resend_commitment, false , $failed_forwards, $failed_fails, Vec :: new( ) )
1400
+ handle_monitor_update_res !( $self, $err, $channel_state, $entry, $action_type, $resend_raa, $resend_commitment, false , $failed_forwards, $failed_fails, Vec :: new( ) )
1401
1401
} ;
1402
1402
}
1403
1403
@@ -1485,7 +1485,7 @@ macro_rules! handle_chan_restoration_locked {
1485
1485
if $raa. is_none( ) {
1486
1486
order = RAACommitmentOrder :: CommitmentFirst ;
1487
1487
}
1488
- break handle_monitor_err !( $self, e, $channel_state, $channel_entry, order, $raa. is_some( ) , true ) ;
1488
+ break handle_monitor_update_res !( $self, e, $channel_state, $channel_entry, order, $raa. is_some( ) , true ) ;
1489
1489
}
1490
1490
}
1491
1491
}
@@ -1839,7 +1839,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
1839
1839
if let Some ( monitor_update) = monitor_update {
1840
1840
let update_res = self . chain_monitor . update_channel ( chan_entry. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
1841
1841
let ( result, is_permanent) =
1842
- handle_monitor_err ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
1842
+ handle_monitor_update_res ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
1843
1843
if is_permanent {
1844
1844
remove_channel ! ( self , channel_state, chan_entry) ;
1845
1845
break result;
@@ -2461,7 +2461,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2461
2461
let update_err = self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
2462
2462
let chan_id = chan. get ( ) . channel_id ( ) ;
2463
2463
match ( update_err,
2464
- handle_monitor_err ! ( self , update_err, channel_state, chan,
2464
+ handle_monitor_update_res ! ( self , update_err, channel_state, chan,
2465
2465
RAACommitmentOrder :: CommitmentFirst , false , true ) )
2466
2466
{
2467
2467
( ChannelMonitorUpdateStatus :: PermanentFailure , Err ( e) ) => break Err ( e) ,
@@ -3200,7 +3200,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3200
3200
match self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) {
3201
3201
ChannelMonitorUpdateStatus :: Completed => { } ,
3202
3202
e => {
3203
- handle_errors. push ( ( chan. get ( ) . get_counterparty_node_id ( ) , handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , true ) ) ) ;
3203
+ handle_errors. push ( ( chan. get ( ) . get_counterparty_node_id ( ) , handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , true ) ) ) ;
3204
3204
continue ;
3205
3205
}
3206
3206
}
@@ -3487,7 +3487,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3487
3487
Ok ( ( ) )
3488
3488
} ,
3489
3489
e => {
3490
- let ( res, drop) = handle_monitor_err ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , chan_id, COMMITMENT_UPDATE_ONLY ) ;
3490
+ let ( res, drop) = handle_monitor_update_res ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , chan_id, COMMITMENT_UPDATE_ONLY ) ;
3491
3491
if drop { retain_channel = false ; }
3492
3492
res
3493
3493
}
@@ -4082,7 +4082,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4082
4082
payment_preimage, e) ;
4083
4083
return ClaimFundsFromHop :: MonitorUpdateFail (
4084
4084
chan. get ( ) . get_counterparty_node_id ( ) ,
4085
- handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , msgs. is_some( ) ) . unwrap_err ( ) ,
4085
+ handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: CommitmentFirst , false , msgs. is_some( ) ) . unwrap_err ( ) ,
4086
4086
Some ( htlc_value_msat)
4087
4087
) ;
4088
4088
}
@@ -4564,7 +4564,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4564
4564
match self . chain_monitor . watch_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor) {
4565
4565
ChannelMonitorUpdateStatus :: Completed => { } ,
4566
4566
e => {
4567
- let mut res = handle_monitor_err ! ( self , e, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , channel_ready. is_some( ) , OPTIONALLY_RESEND_FUNDING_LOCKED ) ;
4567
+ let mut res = handle_monitor_update_res ! ( self , e, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , channel_ready. is_some( ) , OPTIONALLY_RESEND_FUNDING_LOCKED ) ;
4568
4568
if let Err ( MsgHandleErrInternal { ref mut shutdown_finish, .. } ) = res {
4569
4569
// We weren't able to watch the channel to begin with, so no updates should be made on
4570
4570
// it. Previously, full_stack_target found an (unreachable) panic when the
@@ -4650,7 +4650,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4650
4650
if let Some ( monitor_update) = monitor_update {
4651
4651
let update_res = self . chain_monitor . update_channel ( chan_entry. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
4652
4652
let ( result, is_permanent) =
4653
- handle_monitor_err ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
4653
+ handle_monitor_update_res ! ( self , update_res, channel_state. short_to_chan_info, chan_entry. get_mut( ) , RAACommitmentOrder :: CommitmentFirst , chan_entry. key( ) , NO_UPDATE ) ;
4654
4654
if is_permanent {
4655
4655
remove_channel ! ( self , channel_state, chan_entry) ;
4656
4656
break result;
@@ -4843,7 +4843,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4843
4843
Ok ( res) => res
4844
4844
} ;
4845
4845
let update_res = self . chain_monitor . update_channel ( chan. get ( ) . get_funding_txo ( ) . unwrap ( ) , monitor_update) ;
4846
- if let Err ( e) = handle_monitor_err ! ( self , update_res, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , true , commitment_signed. is_some( ) ) {
4846
+ if let Err ( e) = handle_monitor_update_res ! ( self , update_res, channel_state, chan, RAACommitmentOrder :: RevokeAndACKFirst , true , commitment_signed. is_some( ) ) {
4847
4847
return Err ( e) ;
4848
4848
}
4849
4849
@@ -4932,7 +4932,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4932
4932
break Err ( MsgHandleErrInternal :: ignore_no_close ( "Existing pending monitor update prevented responses to RAA" . to_owned ( ) ) ) ;
4933
4933
}
4934
4934
if update_res != ChannelMonitorUpdateStatus :: Completed {
4935
- if let Err ( e) = handle_monitor_err ! ( self , update_res, channel_state, chan,
4935
+ if let Err ( e) = handle_monitor_update_res ! ( self , update_res, channel_state, chan,
4936
4936
RAACommitmentOrder :: CommitmentFirst , false ,
4937
4937
raa_updates. commitment_update. is_some( ) , false ,
4938
4938
raa_updates. accepted_htlcs, raa_updates. failed_htlcs,
@@ -5212,7 +5212,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
5212
5212
} ,
5213
5213
e => {
5214
5214
has_monitor_update = true ;
5215
- let ( res, close_channel) = handle_monitor_err ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , channel_id, COMMITMENT_UPDATE_ONLY ) ;
5215
+ let ( res, close_channel) = handle_monitor_update_res ! ( self , e, short_to_chan_info, chan, RAACommitmentOrder :: CommitmentFirst , channel_id, COMMITMENT_UPDATE_ONLY ) ;
5216
5216
handle_errors. push ( ( chan. get_counterparty_node_id ( ) , res) ) ;
5217
5217
if close_channel { return false ; }
5218
5218
} ,
0 commit comments