Skip to content

Commit dc2888a

Browse files
committed
Rename handle_monitor_err!() handle_monitor_update_res!
1 parent 4af2670 commit dc2888a

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

lightning/src/ln/channelmanager.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -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;
@@ -2470,7 +2470,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
24702470
let update_err = self.chain_monitor.update_channel(chan.get().get_funding_txo().unwrap(), monitor_update);
24712471
let chan_id = chan.get().channel_id();
24722472
match (update_err,
2473-
handle_monitor_err!(self, update_err, channel_state, chan,
2473+
handle_monitor_update_res!(self, update_err, channel_state, chan,
24742474
RAACommitmentOrder::CommitmentFirst, false, true))
24752475
{
24762476
(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
32703270
match self.chain_monitor.update_channel(chan.get().get_funding_txo().unwrap(), monitor_update) {
32713271
ChannelMonitorUpdateResult::UpdateComplete => {},
32723272
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)));
32743274
continue;
32753275
}
32763276
}
@@ -3556,7 +3556,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
35563556
Ok(())
35573557
},
35583558
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);
35603560
if drop { retain_channel = false; }
35613561
res
35623562
}
@@ -4177,7 +4177,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
41774177
payment_preimage, e);
41784178
return ClaimFundsFromHop::MonitorUpdateFail(
41794179
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(),
41814181
Some(htlc_value_msat)
41824182
);
41834183
}
@@ -4656,7 +4656,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
46564656
match self.chain_monitor.watch_channel(chan.get().get_funding_txo().unwrap(), monitor) {
46574657
ChannelMonitorUpdateResult::UpdateComplete => {},
46584658
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);
46604660
if let Err(MsgHandleErrInternal { ref mut shutdown_finish, .. }) = res {
46614661
// We weren't able to watch the channel to begin with, so no updates should be made on
46624662
// 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
47424742
if let Some(monitor_update) = monitor_update {
47434743
let update_res = self.chain_monitor.update_channel(chan_entry.get().get_funding_txo().unwrap(), monitor_update);
47444744
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);
47464746
if is_permanent {
47474747
remove_channel!(self, channel_state, chan_entry);
47484748
break result;
@@ -4933,7 +4933,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
49334933
Ok(res) => res
49344934
};
49354935
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()) {
49374937
return Err(e);
49384938
}
49394939

@@ -5022,7 +5022,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
50225022
break Err(MsgHandleErrInternal::ignore_no_close("Previous monitor update failure prevented responses to RAA".to_owned()));
50235023
}
50245024
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,
50265026
RAACommitmentOrder::CommitmentFirst, false,
50275027
raa_updates.commitment_update.is_some(), false,
50285028
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
52995299
},
53005300
e => {
53015301
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);
53035303
handle_errors.push((chan.get_counterparty_node_id(), res));
53045304
if close_channel { return false; }
53055305
},

0 commit comments

Comments
 (0)