Return ChannelError instead of calling expect
What changed, and why it matters
This change replaces a hard program crash (an 'expect' call that would terminate the node) with a graceful error return when a specific piece of channel state is missing during a splicing operation. Instead of the entire Lightning node panicking and shutting down, the node now reports a controlled channel-closing error. This is a defensive improvement that reduces denial-of-service risk from malformed or unexpected peer messages, but the commit itself does not claim a security vulnerability was fixed.
Treat as a routine hardening patch. Review whether other .expect() calls in the splicing and commitment-handling paths could similarly be converted to controlled errors. No urgent security response is indicated by the commit alone.
Security signals we found
Replaced .expect() panic with ChannelError::close()
Defensive hardening against unexpected None state
Reduces node-wide denial-of-service from single channel panic
No explicit security claim in commit message
Evidence from the diff
In lightning/src/ln/channel.rs, the code previously called .expect() on holder_commitment_point.current_point() during negotiated pending splice handling. If current_point returned None, the node would panic. The patch changes this to return a ChannelError::close() with a descriptive message, plus a debug_assert(false) for internal debugging. This converts a local unrecoverable panic into a recoverable channel error path.
Changed components
lightning/src/ln/channel.rsHolder commitment point handling during splicingChannel error propagationInspect captured patch +6 / −4
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index f3ffd1c..29e7781 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -6984,10 +6984,12 @@ where
.and_then(|funding_negotiation| funding_negotiation.as_funding())
.expect("Funding must exist for negotiated pending splice");
let transaction_number = self.holder_commitment_point.current_transaction_number();
- let commitment_point = self
- .holder_commitment_point
- .current_point()
- .expect("current should be set after receiving the initial commitment_signed");
+ let commitment_point = self.holder_commitment_point.current_point().ok_or_else(|| {
+ debug_assert!(false);
+ ChannelError::close(
+ "current_point should be set for channels initiating splicing".to_owned(),
+ )
+ })?;
let (holder_commitment_tx, _) = self.context.validate_commitment_signed(
pending_splice_funding,
transaction_number,
Why this scored 42/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.