Skip to content

Commit 3c98cbc

Browse files
Rustfmt OutboundPayments::send_payment_for_static_invoice
This method will be edited in upcoming commits, and the codebase policy is to at least consider removing rustfmt::skips when touching a method.
1 parent ee6d868 commit 3c98cbc

File tree

1 file changed

+56
-20
lines changed

1 file changed

+56
-20
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,12 +1195,17 @@ impl OutboundPayments {
11951195
};
11961196
}
11971197

1198-
#[rustfmt::skip]
11991198
pub(super) fn send_payment_for_static_invoice<
1200-
R: Deref, ES: Deref, NS: Deref, NL: Deref, IH, SP, L: Deref
1199+
R: Deref,
1200+
ES: Deref,
1201+
NS: Deref,
1202+
NL: Deref,
1203+
IH,
1204+
SP,
1205+
L: Deref,
12011206
>(
1202-
&self, payment_id: PaymentId, router: &R, first_hops: Vec<ChannelDetails>, inflight_htlcs: IH,
1203-
entropy_source: &ES, node_signer: &NS, node_id_lookup: &NL,
1207+
&self, payment_id: PaymentId, router: &R, first_hops: Vec<ChannelDetails>,
1208+
inflight_htlcs: IH, entropy_source: &ES, node_signer: &NS, node_id_lookup: &NL,
12041209
secp_ctx: &Secp256k1<secp256k1::All>, best_block_height: u32, logger: &L,
12051210
pending_events: &Mutex<VecDeque<(events::Event, Option<EventCompletionAction>)>>,
12061211
send_payment_along_path: SP,
@@ -1214,24 +1219,55 @@ impl OutboundPayments {
12141219
IH: Fn() -> InFlightHtlcs,
12151220
SP: Fn(SendAlongPathArgs) -> Result<(), APIError>,
12161221
{
1217-
let (payment_hash, keysend_preimage, route_params, retry_strategy, invoice_request, invoice) =
1218-
match self.pending_outbound_payments.lock().unwrap().entry(payment_id) {
1219-
hash_map::Entry::Occupied(entry) => match entry.get() {
1220-
PendingOutboundPayment::StaticInvoiceReceived {
1221-
payment_hash, route_params, retry_strategy, keysend_preimage, invoice_request, static_invoice, ..
1222-
} => {
1223-
(*payment_hash, *keysend_preimage, route_params.clone(), *retry_strategy,
1224-
invoice_request.clone(), static_invoice.clone())
1225-
},
1226-
_ => return Err(Bolt12PaymentError::DuplicateInvoice),
1227-
},
1228-
hash_map::Entry::Vacant(_) => return Err(Bolt12PaymentError::UnexpectedInvoice),
1229-
};
1222+
let (
1223+
payment_hash,
1224+
keysend_preimage,
1225+
route_params,
1226+
retry_strategy,
1227+
invoice_request,
1228+
invoice,
1229+
) = match self.pending_outbound_payments.lock().unwrap().entry(payment_id) {
1230+
hash_map::Entry::Occupied(entry) => match entry.get() {
1231+
PendingOutboundPayment::StaticInvoiceReceived {
1232+
payment_hash,
1233+
route_params,
1234+
retry_strategy,
1235+
keysend_preimage,
1236+
invoice_request,
1237+
static_invoice,
1238+
..
1239+
} => (
1240+
*payment_hash,
1241+
*keysend_preimage,
1242+
route_params.clone(),
1243+
*retry_strategy,
1244+
invoice_request.clone(),
1245+
static_invoice.clone(),
1246+
),
1247+
_ => return Err(Bolt12PaymentError::DuplicateInvoice),
1248+
},
1249+
hash_map::Entry::Vacant(_) => return Err(Bolt12PaymentError::UnexpectedInvoice),
1250+
};
12301251
let invoice = PaidBolt12Invoice::StaticInvoice(invoice);
12311252
self.send_payment_for_bolt12_invoice_internal(
1232-
payment_id, payment_hash, Some(keysend_preimage), Some(&invoice_request), invoice, route_params,
1233-
retry_strategy, router, first_hops, inflight_htlcs, entropy_source, node_signer,
1234-
node_id_lookup, secp_ctx, best_block_height, logger, pending_events, send_payment_along_path
1253+
payment_id,
1254+
payment_hash,
1255+
Some(keysend_preimage),
1256+
Some(&invoice_request),
1257+
invoice,
1258+
route_params,
1259+
retry_strategy,
1260+
router,
1261+
first_hops,
1262+
inflight_htlcs,
1263+
entropy_source,
1264+
node_signer,
1265+
node_id_lookup,
1266+
secp_ctx,
1267+
best_block_height,
1268+
logger,
1269+
pending_events,
1270+
send_payment_along_path,
12351271
)
12361272
}
12371273

0 commit comments

Comments
 (0)