Skip to content

Commit efa1b35

Browse files
committed
Rename convert_chan_phase_err
Now that ChannelPhase has been renamed, drop phase from related identifiers.
1 parent 8588943 commit efa1b35

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3012,7 +3012,7 @@ macro_rules! locked_close_channel {
30123012
}
30133013

30143014
/// Returns (boolean indicating if we should remove the Channel object from memory, a mapped error)
3015-
macro_rules! convert_chan_phase_err {
3015+
macro_rules! convert_channel_err {
30163016
($self: ident, $peer_state: expr, $err: expr, $context: expr, $channel_id: expr, MANUAL_CHANNEL_UPDATE, $channel_update: expr) => {
30173017
match $err {
30183018
ChannelError::Warn(msg) => {
@@ -3032,19 +3032,19 @@ macro_rules! convert_chan_phase_err {
30323032
},
30333033
}
30343034
};
3035-
($self: ident, $peer_state: expr, $err: expr, $channel: expr, $channel_id: expr, FUNDED_CHANNEL) => {
3036-
convert_chan_phase_err!($self, $peer_state, $err, $channel.context, $channel_id, MANUAL_CHANNEL_UPDATE, { $self.get_channel_update_for_broadcast(&$channel).ok() })
3035+
($self: ident, $peer_state: expr, $err: expr, $funded_channel: expr, $channel_id: expr, FUNDED_CHANNEL) => {
3036+
convert_channel_err!($self, $peer_state, $err, $funded_channel.context, $channel_id, MANUAL_CHANNEL_UPDATE, { $self.get_channel_update_for_broadcast(&$funded_channel).ok() })
30373037
};
30383038
($self: ident, $peer_state: expr, $err: expr, $context: expr, $channel_id: expr, UNFUNDED_CHANNEL) => {
3039-
convert_chan_phase_err!($self, $peer_state, $err, $context, $channel_id, MANUAL_CHANNEL_UPDATE, None)
3039+
convert_channel_err!($self, $peer_state, $err, $context, $channel_id, MANUAL_CHANNEL_UPDATE, None)
30403040
};
3041-
($self: ident, $peer_state: expr, $err: expr, $channel_phase: expr, $channel_id: expr) => {
3042-
match $channel_phase.as_funded_mut() {
3043-
Some(channel) => {
3044-
convert_chan_phase_err!($self, $peer_state, $err, channel, $channel_id, FUNDED_CHANNEL)
3041+
($self: ident, $peer_state: expr, $err: expr, $channel: expr, $channel_id: expr) => {
3042+
match $channel.as_funded_mut() {
3043+
Some(funded_channel) => {
3044+
convert_channel_err!($self, $peer_state, $err, funded_channel, $channel_id, FUNDED_CHANNEL)
30453045
},
30463046
None => {
3047-
convert_chan_phase_err!($self, $peer_state, $err, $channel_phase.context_mut(), $channel_id, UNFUNDED_CHANNEL)
3047+
convert_channel_err!($self, $peer_state, $err, $channel.context_mut(), $channel_id, UNFUNDED_CHANNEL)
30483048
},
30493049
}
30503050
};
@@ -3056,7 +3056,7 @@ macro_rules! break_chan_phase_entry {
30563056
Ok(res) => res,
30573057
Err(e) => {
30583058
let key = *$entry.key();
3059-
let (drop, res) = convert_chan_phase_err!($self, $peer_state, e, $entry.get_mut(), &key);
3059+
let (drop, res) = convert_channel_err!($self, $peer_state, e, $entry.get_mut(), &key);
30603060
if drop {
30613061
$entry.remove_entry();
30623062
}
@@ -3072,7 +3072,7 @@ macro_rules! try_chan_phase_entry {
30723072
Ok(res) => res,
30733073
Err(e) => {
30743074
let key = *$entry.key();
3075-
let (drop, res) = convert_chan_phase_err!($self, $peer_state, e, $entry.get_mut(), &key);
3075+
let (drop, res) = convert_channel_err!($self, $peer_state, e, $entry.get_mut(), &key);
30763076
if drop {
30773077
$entry.remove_entry();
30783078
}
@@ -6436,7 +6436,7 @@ where
64366436
if chan_needs_persist == NotifyOption::DoPersist { should_persist = NotifyOption::DoPersist; }
64376437

64386438
if let Err(e) = chan.timer_check_closing_negotiation_progress() {
6439-
let (needs_close, err) = convert_chan_phase_err!(self, peer_state, e, chan, chan_id, FUNDED_CHANNEL);
6439+
let (needs_close, err) = convert_channel_err!(self, peer_state, e, chan, chan_id, FUNDED_CHANNEL);
64406440
handle_errors.push((Err(err), counterparty_node_id));
64416441
if needs_close { return false; }
64426442
}
@@ -8064,14 +8064,14 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80648064
// Really we should be returning the channel_id the peer expects based
80658065
// on their funding info here, but they're horribly confused anyway, so
80668066
// there's not a lot we can do to save them.
8067-
return Err(convert_chan_phase_err!(self, peer_state, err, inbound_chan.context, &msg.temporary_channel_id, UNFUNDED_CHANNEL).1);
8067+
return Err(convert_channel_err!(self, peer_state, err, inbound_chan.context, &msg.temporary_channel_id, UNFUNDED_CHANNEL).1);
80688068
},
80698069
}
80708070
},
80718071
Some(Err(mut phase)) => {
80728072
let err_msg = format!("Got an unexpected funding_created message from peer with counterparty_node_id {}", counterparty_node_id);
80738073
let err = ChannelError::close(err_msg);
8074-
return Err(convert_chan_phase_err!(self, peer_state, err, &mut phase, &msg.temporary_channel_id).1);
8074+
return Err(convert_channel_err!(self, peer_state, err, &mut phase, &msg.temporary_channel_id).1);
80758075
},
80768076
None => return Err(MsgHandleErrInternal::send_err_msg_no_close(format!("Got a message for a channel from the wrong node! No such channel for the passed counterparty_node_id {}", counterparty_node_id), msg.temporary_channel_id))
80778077
};
@@ -8081,12 +8081,12 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80818081
macro_rules! fail_chan { ($err: expr) => { {
80828082
// Note that at this point we've filled in the funding outpoint on our
80838083
// channel, but its actually in conflict with another channel. Thus, if
8084-
// we call `convert_chan_phase_err` immediately (thus calling
8084+
// we call `convert_channel_err` immediately (thus calling
80858085
// `locked_close_channel`), we'll remove the existing channel from `outpoint_to_peer`.
80868086
// Thus, we must first unset the funding outpoint on the channel.
80878087
let err = ChannelError::close($err.to_owned());
80888088
chan.unset_funding_info(msg.temporary_channel_id);
8089-
return Err(convert_chan_phase_err!(self, peer_state, err, chan.context, &funded_channel_id, UNFUNDED_CHANNEL).1);
8089+
return Err(convert_channel_err!(self, peer_state, err, chan.context, &funded_channel_id, UNFUNDED_CHANNEL).1);
80908090
} } }
80918091

80928092
match peer_state.channel_by_id.entry(funded_channel_id) {
@@ -8175,7 +8175,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
81758175
// found an (unreachable) panic when the monitor update contained
81768176
// within `shutdown_finish` was applied.
81778177
chan.unset_funding_info(msg.channel_id);
8178-
return Err(convert_chan_phase_err!(self, peer_state, e, chan, &msg.channel_id, FUNDED_CHANNEL).1);
8178+
return Err(convert_channel_err!(self, peer_state, e, chan, &msg.channel_id, FUNDED_CHANNEL).1);
81798179
}
81808180
},
81818181
Err((mut chan, e)) => {
@@ -8184,7 +8184,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
81848184
// We've already removed this outbound channel from the map in
81858185
// `PeerState` above so at this point we just need to clean up any
81868186
// lingering entries concerning this channel as it is safe to do so.
8187-
return Err(convert_chan_phase_err!(self, peer_state, e, chan.context, &msg.channel_id, UNFUNDED_CHANNEL).1);
8187+
return Err(convert_channel_err!(self, peer_state, e, chan.context, &msg.channel_id, UNFUNDED_CHANNEL).1);
81888188
}
81898189
}
81908190
} else {
@@ -9560,7 +9560,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
95609560
},
95619561
Err(e) => {
95629562
has_update = true;
9563-
let (close_channel, res) = convert_chan_phase_err!(self, peer_state, e, chan, channel_id, FUNDED_CHANNEL);
9563+
let (close_channel, res) = convert_channel_err!(self, peer_state, e, chan, channel_id, FUNDED_CHANNEL);
95649564
handle_errors.push((chan.context.get_counterparty_node_id(), Err(res)));
95659565
!close_channel
95669566
}

0 commit comments

Comments
 (0)