Skip to content

Commit 61bd212

Browse files
Move StaticInvoice outbounds out of map before converting to Retryable.
This will allow us to avoid cloning the invoice request when we move it into the new Retryable entry in the next commit.
1 parent 6737ac7 commit 61bd212

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,20 +1289,19 @@ impl OutboundPayments {
12891289
debug_assert!(false);
12901290
return
12911291
},
1292-
PendingOutboundPayment::StaticInvoiceReceived {
1293-
payment_hash, keysend_preimage, retry_strategy, ..
1294-
} => {
1295-
let keysend_preimage = Some(*keysend_preimage);
1292+
PendingOutboundPayment::StaticInvoiceReceived { .. } => {
1293+
let PendingOutboundPayment::StaticInvoiceReceived {
1294+
payment_hash, keysend_preimage, retry_strategy, ..
1295+
} = payment.remove() else { debug_assert!(false); return };
12961296
let total_amount = route_params.final_value_msat;
12971297
let recipient_onion = RecipientOnionFields::spontaneous_empty();
1298-
let retry_strategy = Some(*retry_strategy);
12991298
let payment_params = Some(route_params.payment_params.clone());
13001299
let (retryable_payment, onion_session_privs) = self.create_pending_payment(
1301-
*payment_hash, recipient_onion.clone(), keysend_preimage, &route,
1302-
retry_strategy, payment_params, entropy_source, best_block_height
1300+
payment_hash, recipient_onion.clone(), Some(keysend_preimage), &route,
1301+
Some(retry_strategy), payment_params, entropy_source, best_block_height
13031302
);
1304-
*payment.into_mut() = retryable_payment;
1305-
(total_amount, recipient_onion, keysend_preimage, onion_session_privs)
1303+
outbounds.insert(payment_id, retryable_payment);
1304+
(total_amount, recipient_onion, Some(keysend_preimage), onion_session_privs)
13061305
},
13071306
PendingOutboundPayment::Fulfilled { .. } => {
13081307
log_error!(logger, "Payment already completed");

0 commit comments

Comments
 (0)