Skip to content

Commit dd9aef7

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

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
@@ -3004,7 +3004,7 @@ macro_rules! locked_close_channel {
30043004
}
30053005

30063006
/// Returns (boolean indicating if we should remove the Channel object from memory, a mapped error)
3007-
macro_rules! convert_chan_phase_err {
3007+
macro_rules! convert_channel_err {
30083008
($self: ident, $peer_state: expr, $err: expr, $context: expr, $channel_id: expr, MANUAL_CHANNEL_UPDATE, $channel_update: expr) => {
30093009
match $err {
30103010
ChannelError::Warn(msg) => {
@@ -3024,19 +3024,19 @@ macro_rules! convert_chan_phase_err {
30243024
},
30253025
}
30263026
};
3027-
($self: ident, $peer_state: expr, $err: expr, $channel: expr, $channel_id: expr, FUNDED_CHANNEL) => {
3028-
convert_chan_phase_err!($self, $peer_state, $err, $channel.context, $channel_id, MANUAL_CHANNEL_UPDATE, { $self.get_channel_update_for_broadcast(&$channel).ok() })
3027+
($self: ident, $peer_state: expr, $err: expr, $funded_channel: expr, $channel_id: expr, FUNDED_CHANNEL) => {
3028+
convert_channel_err!($self, $peer_state, $err, $funded_channel.context, $channel_id, MANUAL_CHANNEL_UPDATE, { $self.get_channel_update_for_broadcast(&$funded_channel).ok() })
30293029
};
30303030
($self: ident, $peer_state: expr, $err: expr, $context: expr, $channel_id: expr, UNFUNDED_CHANNEL) => {
3031-
convert_chan_phase_err!($self, $peer_state, $err, $context, $channel_id, MANUAL_CHANNEL_UPDATE, None)
3031+
convert_channel_err!($self, $peer_state, $err, $context, $channel_id, MANUAL_CHANNEL_UPDATE, None)
30323032
};
3033-
($self: ident, $peer_state: expr, $err: expr, $channel_phase: expr, $channel_id: expr) => {
3034-
match $channel_phase.as_funded_mut() {
3035-
Some(channel) => {
3036-
convert_chan_phase_err!($self, $peer_state, $err, channel, $channel_id, FUNDED_CHANNEL)
3033+
($self: ident, $peer_state: expr, $err: expr, $channel: expr, $channel_id: expr) => {
3034+
match $channel.as_funded_mut() {
3035+
Some(funded_channel) => {
3036+
convert_channel_err!($self, $peer_state, $err, funded_channel, $channel_id, FUNDED_CHANNEL)
30373037
},
30383038
None => {
3039-
convert_chan_phase_err!($self, $peer_state, $err, $channel_phase.context_mut(), $channel_id, UNFUNDED_CHANNEL)
3039+
convert_channel_err!($self, $peer_state, $err, $channel.context_mut(), $channel_id, UNFUNDED_CHANNEL)
30403040
},
30413041
}
30423042
};
@@ -3048,7 +3048,7 @@ macro_rules! break_chan_phase_entry {
30483048
Ok(res) => res,
30493049
Err(e) => {
30503050
let key = *$entry.key();
3051-
let (drop, res) = convert_chan_phase_err!($self, $peer_state, e, $entry.get_mut(), &key);
3051+
let (drop, res) = convert_channel_err!($self, $peer_state, e, $entry.get_mut(), &key);
30523052
if drop {
30533053
$entry.remove_entry();
30543054
}
@@ -3064,7 +3064,7 @@ macro_rules! try_chan_phase_entry {
30643064
Ok(res) => res,
30653065
Err(e) => {
30663066
let key = *$entry.key();
3067-
let (drop, res) = convert_chan_phase_err!($self, $peer_state, e, $entry.get_mut(), &key);
3067+
let (drop, res) = convert_channel_err!($self, $peer_state, e, $entry.get_mut(), &key);
30683068
if drop {
30693069
$entry.remove_entry();
30703070
}
@@ -6444,7 +6444,7 @@ where
64446444
if chan_needs_persist == NotifyOption::DoPersist { should_persist = NotifyOption::DoPersist; }
64456445

64466446
if let Err(e) = chan.timer_check_closing_negotiation_progress() {
6447-
let (needs_close, err) = convert_chan_phase_err!(self, peer_state, e, chan, chan_id, FUNDED_CHANNEL);
6447+
let (needs_close, err) = convert_channel_err!(self, peer_state, e, chan, chan_id, FUNDED_CHANNEL);
64486448
handle_errors.push((Err(err), counterparty_node_id));
64496449
if needs_close { return false; }
64506450
}
@@ -8072,14 +8072,14 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80728072
// Really we should be returning the channel_id the peer expects based
80738073
// on their funding info here, but they're horribly confused anyway, so
80748074
// there's not a lot we can do to save them.
8075-
return Err(convert_chan_phase_err!(self, peer_state, err, inbound_chan.context, &msg.temporary_channel_id, UNFUNDED_CHANNEL).1);
8075+
return Err(convert_channel_err!(self, peer_state, err, inbound_chan.context, &msg.temporary_channel_id, UNFUNDED_CHANNEL).1);
80768076
},
80778077
}
80788078
},
80798079
Some(Err(mut phase)) => {
80808080
let err_msg = format!("Got an unexpected funding_created message from peer with counterparty_node_id {}", counterparty_node_id);
80818081
let err = ChannelError::close(err_msg);
8082-
return Err(convert_chan_phase_err!(self, peer_state, err, &mut phase, &msg.temporary_channel_id).1);
8082+
return Err(convert_channel_err!(self, peer_state, err, &mut phase, &msg.temporary_channel_id).1);
80838083
},
80848084
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))
80858085
};
@@ -8089,12 +8089,12 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80898089
macro_rules! fail_chan { ($err: expr) => { {
80908090
// Note that at this point we've filled in the funding outpoint on our
80918091
// channel, but its actually in conflict with another channel. Thus, if
8092-
// we call `convert_chan_phase_err` immediately (thus calling
8092+
// we call `convert_channel_err` immediately (thus calling
80938093
// `locked_close_channel`), we'll remove the existing channel from `outpoint_to_peer`.
80948094
// Thus, we must first unset the funding outpoint on the channel.
80958095
let err = ChannelError::close($err.to_owned());
80968096
chan.unset_funding_info(msg.temporary_channel_id);
8097-
return Err(convert_chan_phase_err!(self, peer_state, err, chan.context, &funded_channel_id, UNFUNDED_CHANNEL).1);
8097+
return Err(convert_channel_err!(self, peer_state, err, chan.context, &funded_channel_id, UNFUNDED_CHANNEL).1);
80988098
} } }
80998099

81008100
match peer_state.channel_by_id.entry(funded_channel_id) {
@@ -8183,7 +8183,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
81838183
// found an (unreachable) panic when the monitor update contained
81848184
// within `shutdown_finish` was applied.
81858185
chan.unset_funding_info(msg.channel_id);
8186-
return Err(convert_chan_phase_err!(self, peer_state, e, chan, &msg.channel_id, FUNDED_CHANNEL).1);
8186+
return Err(convert_channel_err!(self, peer_state, e, chan, &msg.channel_id, FUNDED_CHANNEL).1);
81878187
}
81888188
},
81898189
Err((mut chan, e)) => {
@@ -8192,7 +8192,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
81928192
// We've already removed this outbound channel from the map in
81938193
// `PeerState` above so at this point we just need to clean up any
81948194
// lingering entries concerning this channel as it is safe to do so.
8195-
return Err(convert_chan_phase_err!(self, peer_state, e, chan.context, &msg.channel_id, UNFUNDED_CHANNEL).1);
8195+
return Err(convert_channel_err!(self, peer_state, e, chan.context, &msg.channel_id, UNFUNDED_CHANNEL).1);
81968196
}
81978197
}
81988198
} else {
@@ -9615,7 +9615,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
96159615
},
96169616
Err(e) => {
96179617
has_update = true;
9618-
let (close_channel, res) = convert_chan_phase_err!(self, peer_state, e, chan, channel_id, FUNDED_CHANNEL);
9618+
let (close_channel, res) = convert_channel_err!(self, peer_state, e, chan, channel_id, FUNDED_CHANNEL);
96199619
handle_errors.push((chan.context.get_counterparty_node_id(), Err(res)));
96209620
!close_channel
96219621
}

0 commit comments

Comments
 (0)