Replace macro with direct call to convert_unfunded_channel_err_internal
What changed, and why it matters
This is a small internal code cleanup in the Lightning Dev Kit's Rust implementation. It removes a rarely-used macro branch and replaces two calls with direct function calls. There is no visible security change: the same function runs, with the same arguments, in the same order. The commit message and diff give no indication of a bug fix or security issue.
No security action needed. Treat as a normal refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes the UNFUNDED_CHANNEL arm of the convert_channel_err! macro and changes two call sites to invoke convert_unfunded_channel_err_internal directly. Both previous macro invocations and the new direct calls pass the same $self, err, and chan values and return the same tuple. No logic, error handling, locking, or state mutation behavior is altered.
Changed components
lightning/src/ln/channelmanager.rsInspect captured patch +2 / −5
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index e7131c6..5e1fe59 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -3611,9 +3611,6 @@ fn convert_channel_err_internal<
/// true).
#[rustfmt::skip]
macro_rules! convert_channel_err {
- ($self: ident, $peer_state: expr, $err: expr, $channel: expr, UNFUNDED_CHANNEL) => { {
- $self.convert_unfunded_channel_err_internal($err, $channel)
- } };
($self: ident, $peer_state: expr, $err: expr, $channel: expr) => {
match $channel.as_funded_mut() {
Some(funded_channel) => {
@@ -10506,7 +10503,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
let err = ChannelError::close($err.to_owned());
chan.unset_funding_info();
let mut chan = Channel::from(chan);
- return Err(convert_channel_err!(self, peer_state, err, &mut chan, UNFUNDED_CHANNEL).1);
+ return Err(self.convert_unfunded_channel_err_internal(err, &mut chan).1);
} } }
match peer_state.channel_by_id.entry(funded_channel_id) {
@@ -12506,7 +12503,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
debug_assert!(false);
let reason = shutdown.closure_reason.clone();
let err = ChannelError::Close((reason.to_string(), reason));
- convert_channel_err!(self, peer_state, err, chan, UNFUNDED_CHANNEL)
+ self.convert_unfunded_channel_err_internal(err, chan)
};
debug_assert!(remove);
shutdown_results.push((Err(err), *cp_id));
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.