@@ -3004,7 +3004,7 @@ macro_rules! locked_close_channel {
3004
3004
}
3005
3005
3006
3006
/// 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 {
3008
3008
($self: ident, $peer_state: expr, $err: expr, $context: expr, $channel_id: expr, MANUAL_CHANNEL_UPDATE, $channel_update: expr) => {
3009
3009
match $err {
3010
3010
ChannelError::Warn(msg) => {
@@ -3024,19 +3024,19 @@ macro_rules! convert_chan_phase_err {
3024
3024
},
3025
3025
}
3026
3026
};
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() })
3029
3029
};
3030
3030
($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)
3032
3032
};
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)
3037
3037
},
3038
3038
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)
3040
3040
},
3041
3041
}
3042
3042
};
@@ -3048,7 +3048,7 @@ macro_rules! break_chan_phase_entry {
3048
3048
Ok(res) => res,
3049
3049
Err(e) => {
3050
3050
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);
3052
3052
if drop {
3053
3053
$entry.remove_entry();
3054
3054
}
@@ -3064,7 +3064,7 @@ macro_rules! try_chan_phase_entry {
3064
3064
Ok(res) => res,
3065
3065
Err(e) => {
3066
3066
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);
3068
3068
if drop {
3069
3069
$entry.remove_entry();
3070
3070
}
@@ -6444,7 +6444,7 @@ where
6444
6444
if chan_needs_persist == NotifyOption::DoPersist { should_persist = NotifyOption::DoPersist; }
6445
6445
6446
6446
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);
6448
6448
handle_errors.push((Err(err), counterparty_node_id));
6449
6449
if needs_close { return false; }
6450
6450
}
@@ -8072,14 +8072,14 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8072
8072
// Really we should be returning the channel_id the peer expects based
8073
8073
// on their funding info here, but they're horribly confused anyway, so
8074
8074
// 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);
8076
8076
},
8077
8077
}
8078
8078
},
8079
8079
Some(Err(mut phase)) => {
8080
8080
let err_msg = format!("Got an unexpected funding_created message from peer with counterparty_node_id {}", counterparty_node_id);
8081
8081
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);
8083
8083
},
8084
8084
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))
8085
8085
};
@@ -8089,12 +8089,12 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8089
8089
macro_rules! fail_chan { ($err: expr) => { {
8090
8090
// Note that at this point we've filled in the funding outpoint on our
8091
8091
// 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
8093
8093
// `locked_close_channel`), we'll remove the existing channel from `outpoint_to_peer`.
8094
8094
// Thus, we must first unset the funding outpoint on the channel.
8095
8095
let err = ChannelError::close($err.to_owned());
8096
8096
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);
8098
8098
} } }
8099
8099
8100
8100
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/
8183
8183
// found an (unreachable) panic when the monitor update contained
8184
8184
// within `shutdown_finish` was applied.
8185
8185
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);
8187
8187
}
8188
8188
},
8189
8189
Err((mut chan, e)) => {
@@ -8192,7 +8192,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8192
8192
// We've already removed this outbound channel from the map in
8193
8193
// `PeerState` above so at this point we just need to clean up any
8194
8194
// 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);
8196
8196
}
8197
8197
}
8198
8198
} else {
@@ -9615,7 +9615,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9615
9615
},
9616
9616
Err(e) => {
9617
9617
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);
9619
9619
handle_errors.push((chan.context.get_counterparty_node_id(), Err(res)));
9620
9620
!close_channel
9621
9621
}
0 commit comments