Rustfmt get_counterparty_output_claim_info
What changed, and why it matters
This commit only reformats a single Rust function using rustfmt. It removes a manual formatting override and adjusts line breaks and indentation. No logic, behavior, or security properties of the code are changed.
No security action needed. Treat as a normal code-style commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the #[rustfmt::skip] attribute from get_counterparty_output_claim_info in lightning/src/chain/channelmonitor.rs and applies standard rustfmt formatting. All function calls, control flow, and expressions remain identical; only whitespace and line wrapping differ. The commit message explicitly states this is a formatting-only preparatory step for a later rework.
Changed components
lightning/src/chain/channelmonitor.rsInspect captured patch +41 / −16
diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs
index 5f2bb24..c4bc61d 100644
--- a/lightning/src/chain/channelmonitor.rs
+++ b/lightning/src/chain/channelmonitor.rs
@@ -4733,7 +4733,6 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
/// Returns the HTLC claim package templates and the counterparty output info
- #[rustfmt::skip]
fn get_counterparty_output_claim_info(
&self, funding_spent: &FundingScope, commitment_number: u64, commitment_txid: Txid,
tx: Option<&Transaction>,
@@ -4767,13 +4766,23 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
if let Some(transaction) = tx {
let revocation_pubkey = RevocationKey::from_basepoint(
- &self.onchain_tx_handler.secp_ctx, &self.holder_revocation_basepoint, &per_commitment_point);
+ &self.onchain_tx_handler.secp_ctx,
+ &self.holder_revocation_basepoint,
+ &per_commitment_point,
+ );
- let delayed_key = DelayedPaymentKey::from_basepoint(&self.onchain_tx_handler.secp_ctx, &self.counterparty_commitment_params.counterparty_delayed_payment_base_key, &per_commitment_point);
+ let delayed_key = DelayedPaymentKey::from_basepoint(
+ &self.onchain_tx_handler.secp_ctx,
+ &self.counterparty_commitment_params.counterparty_delayed_payment_base_key,
+ &per_commitment_point,
+ );
- let revokeable_p2wsh = chan_utils::get_revokeable_redeemscript(&revocation_pubkey,
+ let revokeable_p2wsh = chan_utils::get_revokeable_redeemscript(
+ &revocation_pubkey,
self.counterparty_commitment_params.on_counterparty_tx_csv,
- &delayed_key).to_p2wsh();
+ &delayed_key,
+ )
+ .to_p2wsh();
for (idx, outp) in transaction.output.iter().enumerate() {
if outp.script_pubkey == revokeable_p2wsh {
to_counterparty_output_info =
@@ -4782,25 +4791,36 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
}
}
- for &(ref htlc, _) in per_commitment_claimable_data.iter() {
+ for &(ref htlc, _) in per_commitment_claimable_data.iter() {
if let Some(transaction_output_index) = htlc.transaction_output_index {
if let Some(transaction) = tx {
- if transaction_output_index as usize >= transaction.output.len() ||
- transaction.output[transaction_output_index as usize].value != htlc.to_bitcoin_amount() {
- // per_commitment_data is corrupt or our commitment signing key leaked!
- return (claimable_outpoints, to_counterparty_output_info);
- }
+ if transaction_output_index as usize >= transaction.output.len()
+ || transaction.output[transaction_output_index as usize].value
+ != htlc.to_bitcoin_amount()
+ {
+ // per_commitment_data is corrupt or our commitment signing key leaked!
+ return (claimable_outpoints, to_counterparty_output_info);
+ }
}
- let preimage = if htlc.offered { if let Some((p, _)) = self.payment_preimages.get(&htlc.payment_hash) { Some(*p) } else { None } } else { None };
+ let preimage = if htlc.offered {
+ if let Some((p, _)) = self.payment_preimages.get(&htlc.payment_hash) {
+ Some(*p)
+ } else {
+ None
+ }
+ } else {
+ None
+ };
if preimage.is_some() || !htlc.offered {
let counterparty_htlc_outp = if htlc.offered {
PackageSolvingData::CounterpartyOfferedHTLCOutput(
CounterpartyOfferedHTLCOutput::build(
- *per_commitment_point, preimage.unwrap(),
+ *per_commitment_point,
+ preimage.unwrap(),
htlc.clone(),
funding_spent.channel_parameters.clone(),
confirmation_height,
- )
+ ),
)
} else {
PackageSolvingData::CounterpartyReceivedHTLCOutput(
@@ -4809,10 +4829,15 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
htlc.clone(),
funding_spent.channel_parameters.clone(),
confirmation_height,
- )
+ ),
)
};
- let counterparty_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc.cltv_expiry);
+ let counterparty_package = PackageTemplate::build_package(
+ commitment_txid,
+ transaction_output_index,
+ counterparty_htlc_outp,
+ htlc.cltv_expiry,
+ );
claimable_outpoints.push(counterparty_package);
}
}
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.