What changed, and why it matters
This commit is purely a code-formatting cleanup. It removes `#[rustfmt::skip]` annotations from three methods in the Lightning channel code and lets rustfmt reformat the function signatures, calls, and log statements across multiple lines. No logic, behavior, or security checks were changed.
No security action needed. Treat as a normal style/refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff removes #[rustfmt::skip] from initial_commitment_signed_v2, funding_signed, and funding_created in lightning/src/ln/channel.rs. It reformats long signatures, argument lists, match arms, and macro invocations to comply with rustfmt style. All control flow, validation conditions, error messages, function calls, and return values remain identical to the original code.
Changed components
lightning/src/ln/channel.rsInspect captured patch +147 / −42
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index f2775b6..3667e08 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -7886,11 +7886,12 @@ where
Ok(())
}
- #[rustfmt::skip]
pub fn initial_commitment_signed_v2<L: Deref>(
- &mut self, msg: &msgs::CommitmentSigned, best_block: BestBlock, signer_provider: &SP, logger: &L
+ &mut self, msg: &msgs::CommitmentSigned, best_block: BestBlock, signer_provider: &SP,
+ logger: &L,
) -> Result<ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>, ChannelError>
- where L::Target: Logger
+ where
+ L::Target: Logger,
{
if let Some(signing_session) = self.context.interactive_tx_signing_session.as_ref() {
if signing_session.has_received_tx_signatures() {
@@ -7905,16 +7906,41 @@ where
};
let holder_commitment_point = &mut self.holder_commitment_point.clone();
- self.context.assert_no_commitment_advancement(holder_commitment_point.next_transaction_number(), "initial commitment_signed");
+ self.context.assert_no_commitment_advancement(
+ holder_commitment_point.next_transaction_number(),
+ "initial commitment_signed",
+ );
let (channel_monitor, _) = self.initial_commitment_signed(
- self.context.channel_id(), msg.signature, holder_commitment_point, best_block, signer_provider, logger)?;
+ self.context.channel_id(),
+ msg.signature,
+ holder_commitment_point,
+ best_block,
+ signer_provider,
+ logger,
+ )?;
self.holder_commitment_point = *holder_commitment_point;
- log_info!(logger, "Received initial commitment_signed from peer for channel {}", &self.context.channel_id());
+ log_info!(
+ logger,
+ "Received initial commitment_signed from peer for channel {}",
+ &self.context.channel_id()
+ );
- self.monitor_updating_paused(false, false, false, Vec::new(), Vec::new(), Vec::new(), logger);
- self.context.interactive_tx_signing_session.as_mut().expect("signing session should be present").received_commitment_signed();
+ self.monitor_updating_paused(
+ false,
+ false,
+ false,
+ Vec::new(),
+ Vec::new(),
+ Vec::new(),
+ logger,
+ );
+ self.context
+ .interactive_tx_signing_session
+ .as_mut()
+ .expect("signing session should be present")
+ .received_commitment_signed();
Ok(channel_monitor)
}
@@ -13769,34 +13795,61 @@ where
/// Handles a funding_signed message from the remote end.
/// If this call is successful, broadcast the funding transaction (and not before!)
- #[rustfmt::skip]
pub fn funding_signed<L: Deref>(
- mut self, msg: &msgs::FundingSigned, best_block: BestBlock, signer_provider: &SP, logger: &L
- ) -> Result<(FundedChannel<SP>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), (OutboundV1Channel<SP>, ChannelError)>
+ mut self, msg: &msgs::FundingSigned, best_block: BestBlock, signer_provider: &SP,
+ logger: &L,
+ ) -> Result<
+ (FundedChannel<SP>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>),
+ (OutboundV1Channel<SP>, ChannelError),
+ >
where
- L::Target: Logger
+ L::Target: Logger,
{
if !self.funding.is_outbound() {
- return Err((self, ChannelError::close("Received funding_signed for an inbound channel?".to_owned())));
+ return Err((
+ self,
+ ChannelError::close("Received funding_signed for an inbound channel?".to_owned()),
+ ));
}
if !matches!(self.context.channel_state, ChannelState::FundingNegotiated(_)) {
- return Err((self, ChannelError::close("Received funding_signed in strange state!".to_owned())));
+ return Err((
+ self,
+ ChannelError::close("Received funding_signed in strange state!".to_owned()),
+ ));
}
- let mut holder_commitment_point = match self.unfunded_context.holder_commitment_point {
- Some(point) => point,
- None => return Err((self, ChannelError::close("Received funding_signed before our first commitment point was available".to_owned()))),
- };
- self.context.assert_no_commitment_advancement(holder_commitment_point.next_transaction_number(), "funding_signed");
+ let mut holder_commitment_point =
+ match self.unfunded_context.holder_commitment_point {
+ Some(point) => point,
+ None => return Err((
+ self,
+ ChannelError::close(
+ "Received funding_signed before our first commitment point was available"
+ .to_owned(),
+ ),
+ )),
+ };
+ self.context.assert_no_commitment_advancement(
+ holder_commitment_point.next_transaction_number(),
+ "funding_signed",
+ );
let (channel_monitor, _) = match self.initial_commitment_signed(
- self.context.channel_id(), msg.signature,
- &mut holder_commitment_point, best_block, signer_provider, logger
+ self.context.channel_id(),
+ msg.signature,
+ &mut holder_commitment_point,
+ best_block,
+ signer_provider,
+ logger,
) {
Ok(channel_monitor) => channel_monitor,
Err(err) => return Err((self, err)),
};
- log_info!(logger, "Received funding_signed from peer for channel {}", &self.context.channel_id());
+ log_info!(
+ logger,
+ "Received funding_signed from peer for channel {}",
+ &self.context.channel_id()
+ );
let mut channel = FundedChannel {
funding: self.funding,
@@ -13808,7 +13861,15 @@ where
let need_channel_ready = channel.check_get_channel_ready(0, logger).is_some()
|| channel.context.signer_pending_channel_ready;
- channel.monitor_updating_paused(false, false, need_channel_ready, Vec::new(), Vec::new(), Vec::new(), logger);
+ channel.monitor_updating_paused(
+ false,
+ false,
+ need_channel_ready,
+ Vec::new(),
+ Vec::new(),
+ Vec::new(),
+ logger,
+ );
Ok((channel, channel_monitor))
}
@@ -14041,15 +14102,25 @@ where
self.generate_accept_channel_message(logger)
}
- #[rustfmt::skip]
pub fn funding_created<L: Deref>(
- mut self, msg: &msgs::FundingCreated, best_block: BestBlock, signer_provider: &SP, logger: &L
- ) -> Result<(FundedChannel<SP>, Option<msgs::FundingSigned>, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), (Self, ChannelError)>
+ mut self, msg: &msgs::FundingCreated, best_block: BestBlock, signer_provider: &SP,
+ logger: &L,
+ ) -> Result<
+ (
+ FundedChannel<SP>,
+ Option<msgs::FundingSigned>,
+ ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>,
+ ),
+ (Self, ChannelError),
+ >
where
- L::Target: Logger
+ L::Target: Logger,
{
if self.funding.is_outbound() {
- return Err((self, ChannelError::close("Received funding_created for an outbound channel?".to_owned())));
+ return Err((
+ self,
+ ChannelError::close("Received funding_created for an outbound channel?".to_owned()),
+ ));
}
if !matches!(
self.context.channel_state, ChannelState::NegotiatingFunding(flags)
@@ -14058,31 +14129,57 @@ where
// BOLT 2 says that if we disconnect before we send funding_signed we SHOULD NOT
// remember the channel, so it's safe to just send an error_message here and drop the
// channel.
- return Err((self, ChannelError::close("Received funding_created after we got the channel!".to_owned())));
+ return Err((
+ self,
+ ChannelError::close(
+ "Received funding_created after we got the channel!".to_owned(),
+ ),
+ ));
}
- let mut holder_commitment_point = match self.unfunded_context.holder_commitment_point {
- Some(point) => point,
- None => return Err((self, ChannelError::close("Received funding_created before our first commitment point was available".to_owned()))),
- };
- self.context.assert_no_commitment_advancement(holder_commitment_point.next_transaction_number(), "funding_created");
+ let mut holder_commitment_point =
+ match self.unfunded_context.holder_commitment_point {
+ Some(point) => point,
+ None => return Err((
+ self,
+ ChannelError::close(
+ "Received funding_created before our first commitment point was available"
+ .to_owned(),
+ ),
+ )),
+ };
+ self.context.assert_no_commitment_advancement(
+ holder_commitment_point.next_transaction_number(),
+ "funding_created",
+ );
let funding_txo = OutPoint { txid: msg.funding_txid, index: msg.funding_output_index };
self.funding.channel_transaction_parameters.funding_outpoint = Some(funding_txo);
- let (channel_monitor, counterparty_initial_commitment_tx) = match self.initial_commitment_signed(
- ChannelId::v1_from_funding_outpoint(funding_txo), msg.signature,
- &mut holder_commitment_point, best_block, signer_provider, logger
- ) {
+ let (channel_monitor, counterparty_initial_commitment_tx) = match self
+ .initial_commitment_signed(
+ ChannelId::v1_from_funding_outpoint(funding_txo),
+ msg.signature,
+ &mut holder_commitment_point,
+ best_block,
+ signer_provider,
+ logger,
+ ) {
Ok(channel_monitor) => channel_monitor,
Err(err) => return Err((self, err)),
};
let funding_signed = self.context.get_funding_signed_msg(
- &self.funding.channel_transaction_parameters, logger, counterparty_initial_commitment_tx
+ &self.funding.channel_transaction_parameters,
+ logger,
+ counterparty_initial_commitment_tx,
);
- log_info!(logger, "{} funding_signed for peer for channel {}",
- if funding_signed.is_some() { "Generated" } else { "Waiting for signature on" }, &self.context.channel_id());
+ log_info!(
+ logger,
+ "{} funding_signed for peer for channel {}",
+ if funding_signed.is_some() { "Generated" } else { "Waiting for signature on" },
+ &self.context.channel_id()
+ );
// Promote the channel to a full-fledged one now that we have updated the state and have a
// `ChannelMonitor`.
@@ -14095,7 +14192,15 @@ where
};
let need_channel_ready = channel.check_get_channel_ready(0, logger).is_some()
|| channel.context.signer_pending_channel_ready;
- channel.monitor_updating_paused(false, false, need_channel_ready, Vec::new(), Vec::new(), Vec::new(), logger);
+ channel.monitor_updating_paused(
+ false,
+ false,
+ need_channel_ready,
+ Vec::new(),
+ Vec::new(),
+ Vec::new(),
+ logger,
+ );
Ok((channel, funding_signed, channel_monitor))
}
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.