Consistently log in propose_quiescence
What changed, and why it matters
This is a minor code cleanup change. It moves logging messages into a single function and simplifies the function's return type by removing an error string. There is no security impact.
No action required. This is a non-security refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors propose_quiescence in lightning/src/ln/channel.rs to log internally rather than returning a (&'static str, QuiescentAction) tuple. Callers in channelmanager.rs and channel.rs are updated to match the new Result<Option<msgs::Stfu>, QuiescentAction> signature. The behavior is functionally equivalent: the same conditions are checked, the same actions are returned, and logging still occurs. No security-sensitive logic is altered.
Changed components
lightning/src/ln/channel.rslightning/src/ln/channelmanager.rsInspect captured patch +10 / −6
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index db85a26..0f1916a 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -12214,8 +12214,7 @@ where
}
self.propose_quiescence(logger, QuiescentAction::Splice { contribution, locktime }).map_err(
- |(e, action)| {
- log_error!(logger, "{}", e);
+ |action| {
// FIXME: Any better way to do this?
if let QuiescentAction::Splice { contribution, .. } = action {
let (contributed_inputs, contributed_outputs) =
@@ -13355,14 +13354,19 @@ where
#[rustfmt::skip]
pub fn propose_quiescence<L: Logger>(
&mut self, logger: &L, action: QuiescentAction,
- ) -> Result<Option<msgs::Stfu>, (&'static str, QuiescentAction)> {
+ ) -> Result<Option<msgs::Stfu>, QuiescentAction> {
log_debug!(logger, "Attempting to initiate quiescence");
if !self.context.is_usable() {
- return Err(("Channel is not in a usable state to propose quiescence", action));
+ log_debug!(logger, "Channel is not in a usable state to propose quiescence");
+ return Err(action);
}
if self.quiescent_action.is_some() {
- return Err(("Channel already has a pending quiescent action and cannot start another", action));
+ log_debug!(
+ logger,
+ "Channel already has a pending quiescent action and cannot start another",
+ );
+ return Err(action);
}
self.quiescent_action = Some(action);
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index f70f4b1..75de6ab 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -13401,7 +13401,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
});
notify = NotifyOption::SkipPersistHandleEvents;
},
- Err((msg, _action)) => log_trace!(logger, "{}", msg),
+ Err(action) => log_trace!(logger, "Failed to propose quiescence for: {:?}", action),
}
} else {
result = Err(APIError::APIMisuseError {
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.