Skip to content

Commit b58c941

Browse files
committed
Rename handle_monitor_err!() handle_monitor_update_res!
1 parent 42fbbb7 commit b58c941

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
@@ -1329,7 +1329,7 @@ macro_rules! remove_channel {
13291329
}
13301330
}
13311331

1332-
macro_rules! handle_monitor_err {
1332+
macro_rules! handle_monitor_update_res {
13331333
($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) => {
13341334
match $err {
13351335
ChannelMonitorUpdateStatus::PermanentFailure => {
@@ -1377,27 +1377,27 @@ macro_rules! handle_monitor_err {
13771377
}
13781378
};
13791379
($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());
13811381
if drop {
13821382
$entry.remove_entry();
13831383
}
13841384
res
13851385
} };
13861386
($self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $chan_id: expr, COMMITMENT_UPDATE_ONLY) => { {
13871387
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)
13891389
} };
13901390
($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)
13921392
};
13931393
($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())
13951395
};
13961396
($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())
13981398
};
13991399
($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())
14011401
};
14021402
}
14031403

@@ -1485,7 +1485,7 @@ macro_rules! handle_chan_restoration_locked {
14851485
if $raa.is_none() {
14861486
order = RAACommitmentOrder::CommitmentFirst;
14871487
}
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);
14891489
}
14901490
}
14911491
}
@@ -1839,7 +1839,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
18391839
if let Some(monitor_update) = monitor_update {
18401840
let update_res = self.chain_monitor.update_channel(chan_entry.get().get_funding_txo().unwrap(), monitor_update);
18411841
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);
18431843
if is_permanent {
18441844
remove_channel!(self, channel_state, chan_entry);
18451845
break result;
@@ -2461,7 +2461,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
24612461
let update_err = self.chain_monitor.update_channel(chan.get().get_funding_txo().unwrap(), monitor_update);
24622462
let chan_id = chan.get().channel_id();
24632463
match (update_err,
2464-
handle_monitor_err!(self, update_err, channel_state, chan,
2464+
handle_monitor_update_res!(self, update_err, channel_state, chan,
24652465
RAACommitmentOrder::CommitmentFirst, false, true))
24662466
{
24672467
(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
32003200
match self.chain_monitor.update_channel(chan.get().get_funding_txo().unwrap(), monitor_update) {
32013201
ChannelMonitorUpdateStatus::Completed => {},
32023202
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)));
32043204
continue;
32053205
}
32063206
}
@@ -3487,7 +3487,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34873487
Ok(())
34883488
},
34893489
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);
34913491
if drop { retain_channel = false; }
34923492
res
34933493
}
@@ -4082,7 +4082,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
40824082
payment_preimage, e);
40834083
return ClaimFundsFromHop::MonitorUpdateFail(
40844084
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(),
40864086
Some(htlc_value_msat)
40874087
);
40884088
}
@@ -4564,7 +4564,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
45644564
match self.chain_monitor.watch_channel(chan.get().get_funding_txo().unwrap(), monitor) {
45654565
ChannelMonitorUpdateStatus::Completed => {},
45664566
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);
45684568
if let Err(MsgHandleErrInternal { ref mut shutdown_finish, .. }) = res {
45694569
// We weren't able to watch the channel to begin with, so no updates should be made on
45704570
// 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
46504650
if let Some(monitor_update) = monitor_update {
46514651
let update_res = self.chain_monitor.update_channel(chan_entry.get().get_funding_txo().unwrap(), monitor_update);
46524652
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);
46544654
if is_permanent {
46554655
remove_channel!(self, channel_state, chan_entry);
46564656
break result;
@@ -4843,7 +4843,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
48434843
Ok(res) => res
48444844
};
48454845
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()) {
48474847
return Err(e);
48484848
}
48494849

@@ -4932,7 +4932,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
49324932
break Err(MsgHandleErrInternal::ignore_no_close("Existing pending monitor update prevented responses to RAA".to_owned()));
49334933
}
49344934
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,
49364936
RAACommitmentOrder::CommitmentFirst, false,
49374937
raa_updates.commitment_update.is_some(), false,
49384938
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
52125212
},
52135213
e => {
52145214
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);
52165216
handle_errors.push((chan.get_counterparty_node_id(), res));
52175217
if close_channel { return false; }
52185218
},

0 commit comments

Comments
 (0)