Skip to content

Commit f7548e3

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 fa79ea7 commit f7548e3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,20 +1315,20 @@ impl OutboundPayments {
13151315
debug_assert!(false);
13161316
return
13171317
},
1318-
PendingOutboundPayment::StaticInvoiceReceived {
1319-
payment_hash, keysend_preimage, retry_strategy, ..
1320-
} => {
1321-
let keysend_preimage = Some(*keysend_preimage);
1318+
PendingOutboundPayment::StaticInvoiceReceived { .. } => {
1319+
let PendingOutboundPayment::StaticInvoiceReceived {
1320+
payment_hash, keysend_preimage, retry_strategy, ..
1321+
} = payment.remove() else { debug_assert!(false); return };
13221322
let total_amount = route_params.final_value_msat;
13231323
let recipient_onion = RecipientOnionFields::spontaneous_empty();
1324-
let retry_strategy = Some(*retry_strategy);
1324+
let retry_strategy = Some(retry_strategy);
13251325
let payment_params = Some(route_params.payment_params.clone());
13261326
let (retryable_payment, onion_session_privs) = self.create_pending_payment(
1327-
*payment_hash, recipient_onion.clone(), keysend_preimage, &route,
1327+
payment_hash, recipient_onion.clone(), Some(keysend_preimage), &route,
13281328
retry_strategy, payment_params, entropy_source, best_block_height
13291329
);
1330-
*payment.into_mut() = retryable_payment;
1331-
(total_amount, recipient_onion, keysend_preimage, onion_session_privs)
1330+
outbounds.insert(payment_id, retryable_payment);
1331+
(total_amount, recipient_onion, Some(keysend_preimage), onion_session_privs)
13321332
},
13331333
PendingOutboundPayment::Fulfilled { .. } => {
13341334
log_error!(logger, "Payment already completed");

0 commit comments

Comments
 (0)