Skip to content

Commit 00c52ec

Browse files
Add hold_htlcs param to pay_route_internal
As part of supporting sending payments as an often-offline sender, the sender needs to be able to set a flag in their update_add_htlc message indicating that the HTLC should be held until receipt of a release_held_htlc onion message from the often-offline payment recipient. We don't yet ever set this flag, but lay the groundwork by including the parameter in the pay_route method. See-also <lightning/bolts#989>
1 parent a42a260 commit 00c52ec

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,8 @@ impl OutboundPayments {
10891089

10901090
let result = self.pay_route_internal(
10911091
&route, payment_hash, &recipient_onion, keysend_preimage, invoice_request, Some(&bolt12_invoice), payment_id,
1092-
Some(route_params.final_value_msat), &onion_session_privs, node_signer, best_block_height,
1093-
&send_payment_along_path
1092+
Some(route_params.final_value_msat), &onion_session_privs, false, node_signer,
1093+
best_block_height, &send_payment_along_path
10941094
);
10951095
log_info!(
10961096
logger, "Sending payment with id {} and hash {} returned {:?}", payment_id,
@@ -1486,7 +1486,7 @@ impl OutboundPayments {
14861486
})?;
14871487

14881488
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion,
1489-
keysend_preimage, None, None, payment_id, None, &onion_session_privs, node_signer,
1489+
keysend_preimage, None, None, payment_id, None, &onion_session_privs, false, node_signer,
14901490
best_block_height, &send_payment_along_path);
14911491
log_info!(logger, "Sending payment with id {} and hash {} returned {:?}",
14921492
payment_id, payment_hash, res);
@@ -1649,8 +1649,8 @@ impl OutboundPayments {
16491649
}
16501650
};
16511651
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion, keysend_preimage,
1652-
invoice_request.as_ref(), bolt12_invoice.as_ref(), payment_id, Some(total_msat), &onion_session_privs, node_signer,
1653-
best_block_height, &send_payment_along_path);
1652+
invoice_request.as_ref(), bolt12_invoice.as_ref(), payment_id, Some(total_msat),
1653+
&onion_session_privs, false, node_signer, best_block_height, &send_payment_along_path);
16541654
log_info!(logger, "Result retrying payment id {}: {:?}", &payment_id, res);
16551655
if let Err(e) = res {
16561656
self.handle_pay_route_err(
@@ -1814,8 +1814,8 @@ impl OutboundPayments {
18141814

18151815
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
18161816
match self.pay_route_internal(&route, payment_hash, &recipient_onion_fields,
1817-
None, None, None, payment_id, None, &onion_session_privs, node_signer, best_block_height,
1818-
&send_payment_along_path
1817+
None, None, None, payment_id, None, &onion_session_privs, false, node_signer,
1818+
best_block_height, &send_payment_along_path
18191819
) {
18201820
Ok(()) => Ok((payment_hash, payment_id)),
18211821
Err(e) => {
@@ -2063,7 +2063,7 @@ impl OutboundPayments {
20632063
&self, route: &Route, payment_hash: PaymentHash, recipient_onion: &RecipientOnionFields,
20642064
keysend_preimage: Option<PaymentPreimage>, invoice_request: Option<&InvoiceRequest>, bolt12_invoice: Option<&PaidBolt12Invoice>,
20652065
payment_id: PaymentId, recv_value_msat: Option<u64>, onion_session_privs: &Vec<[u8; 32]>,
2066-
node_signer: &NS, best_block_height: u32, send_payment_along_path: &F
2066+
hold_htlcs_at_next_hop: bool, node_signer: &NS, best_block_height: u32, send_payment_along_path: &F
20672067
) -> Result<(), PaymentSendFailure>
20682068
where
20692069
NS::Target: NodeSigner,
@@ -2186,7 +2186,7 @@ impl OutboundPayments {
21862186
{
21872187
self.pay_route_internal(route, payment_hash, &recipient_onion,
21882188
keysend_preimage, None, None, payment_id, recv_value_msat, &onion_session_privs,
2189-
node_signer, best_block_height, &send_payment_along_path)
2189+
false, node_signer, best_block_height, &send_payment_along_path)
21902190
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
21912191
}
21922192

0 commit comments

Comments
 (0)