Rustfmt OutboundPayments::send_payment_for_static_invoice
What changed, and why it matters
This commit is purely a formatting cleanup. It removes a 'rustfmt::skip' directive and lets the Rust formatter reformat a single method's signature, destructuring pattern, and function call argument list. No logic, behavior, or security properties of the code change.
No security action needed. Treat as normal code-style maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff only rewrites send_payment_for_static_invoice in lightning/src/ln/outbound_payment.rs to conform to rustfmt style: generic bounds are split onto separate lines, a tuple destructuring is expanded vertically, and a multi-argument function call is reformatted with trailing commas. The actual statements, types, variable bindings, control flow, and function call arguments are identical before and after.
Changed components
lightning/src/ln/outbound_payment.rsInspect captured patch +56 / −20
diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs
index 476964d..b174353 100644
--- a/lightning/src/ln/outbound_payment.rs
+++ b/lightning/src/ln/outbound_payment.rs
@@ -1195,12 +1195,17 @@ impl OutboundPayments {
};
}
- #[rustfmt::skip]
pub(super) fn send_payment_for_static_invoice<
- R: Deref, ES: Deref, NS: Deref, NL: Deref, IH, SP, L: Deref
+ R: Deref,
+ ES: Deref,
+ NS: Deref,
+ NL: Deref,
+ IH,
+ SP,
+ L: Deref,
>(
- &self, payment_id: PaymentId, router: &R, first_hops: Vec<ChannelDetails>, inflight_htlcs: IH,
- entropy_source: &ES, node_signer: &NS, node_id_lookup: &NL,
+ &self, payment_id: PaymentId, router: &R, first_hops: Vec<ChannelDetails>,
+ inflight_htlcs: IH, entropy_source: &ES, node_signer: &NS, node_id_lookup: &NL,
secp_ctx: &Secp256k1<secp256k1::All>, best_block_height: u32, logger: &L,
pending_events: &Mutex<VecDeque<(events::Event, Option<EventCompletionAction>)>>,
send_payment_along_path: SP,
@@ -1214,24 +1219,55 @@ impl OutboundPayments {
IH: Fn() -> InFlightHtlcs,
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
{
- let (payment_hash, keysend_preimage, route_params, retry_strategy, invoice_request, invoice) =
- match self.pending_outbound_payments.lock().unwrap().entry(payment_id) {
- hash_map::Entry::Occupied(entry) => match entry.get() {
- PendingOutboundPayment::StaticInvoiceReceived {
- payment_hash, route_params, retry_strategy, keysend_preimage, invoice_request, static_invoice, ..
- } => {
- (*payment_hash, *keysend_preimage, route_params.clone(), *retry_strategy,
- invoice_request.clone(), static_invoice.clone())
- },
- _ => return Err(Bolt12PaymentError::DuplicateInvoice),
- },
- hash_map::Entry::Vacant(_) => return Err(Bolt12PaymentError::UnexpectedInvoice),
- };
+ let (
+ payment_hash,
+ keysend_preimage,
+ route_params,
+ retry_strategy,
+ invoice_request,
+ invoice,
+ ) = match self.pending_outbound_payments.lock().unwrap().entry(payment_id) {
+ hash_map::Entry::Occupied(entry) => match entry.get() {
+ PendingOutboundPayment::StaticInvoiceReceived {
+ payment_hash,
+ route_params,
+ retry_strategy,
+ keysend_preimage,
+ invoice_request,
+ static_invoice,
+ ..
+ } => (
+ *payment_hash,
+ *keysend_preimage,
+ route_params.clone(),
+ *retry_strategy,
+ invoice_request.clone(),
+ static_invoice.clone(),
+ ),
+ _ => return Err(Bolt12PaymentError::DuplicateInvoice),
+ },
+ hash_map::Entry::Vacant(_) => return Err(Bolt12PaymentError::UnexpectedInvoice),
+ };
let invoice = PaidBolt12Invoice::StaticInvoice(invoice);
self.send_payment_for_bolt12_invoice_internal(
- payment_id, payment_hash, Some(keysend_preimage), Some(&invoice_request), invoice, route_params,
- retry_strategy, router, first_hops, inflight_htlcs, entropy_source, node_signer,
- node_id_lookup, secp_ctx, best_block_height, logger, pending_events, send_payment_along_path
+ payment_id,
+ payment_hash,
+ Some(keysend_preimage),
+ Some(&invoice_request),
+ invoice,
+ route_params,
+ retry_strategy,
+ router,
+ first_hops,
+ inflight_htlcs,
+ entropy_source,
+ node_signer,
+ node_id_lookup,
+ secp_ctx,
+ best_block_height,
+ logger,
+ pending_events,
+ send_payment_along_path,
)
}
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.