Skip to content

Commit f988dca

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 08c4be6 commit f988dca

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
@@ -1097,8 +1097,8 @@ where
10971097

10981098
let result = self.pay_route_internal(
10991099
&route, payment_hash, &recipient_onion, keysend_preimage, invoice_request, Some(&bolt12_invoice), payment_id,
1100-
Some(route_params.final_value_msat), &onion_session_privs, node_signer, best_block_height,
1101-
&send_payment_along_path
1100+
Some(route_params.final_value_msat), &onion_session_privs, false, node_signer,
1101+
best_block_height, &send_payment_along_path
11021102
);
11031103
log_info!(
11041104
self.logger, "Sending payment with id {} and hash {} returned {:?}", payment_id,
@@ -1489,7 +1489,7 @@ where
14891489
})?;
14901490

14911491
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion,
1492-
keysend_preimage, None, None, payment_id, None, &onion_session_privs, node_signer,
1492+
keysend_preimage, None, None, payment_id, None, &onion_session_privs, false, node_signer,
14931493
best_block_height, &send_payment_along_path);
14941494
log_info!(self.logger, "Sending payment with id {} and hash {} returned {:?}",
14951495
payment_id, payment_hash, res);
@@ -1652,8 +1652,8 @@ where
16521652
}
16531653
};
16541654
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion, keysend_preimage,
1655-
invoice_request.as_ref(), bolt12_invoice.as_ref(), payment_id, Some(total_msat), &onion_session_privs, node_signer,
1656-
best_block_height, &send_payment_along_path);
1655+
invoice_request.as_ref(), bolt12_invoice.as_ref(), payment_id, Some(total_msat),
1656+
&onion_session_privs, false, node_signer, best_block_height, &send_payment_along_path);
16571657
log_info!(self.logger, "Result retrying payment id {}: {:?}", &payment_id, res);
16581658
if let Err(e) = res {
16591659
self.handle_pay_route_err(
@@ -1813,8 +1813,8 @@ where
18131813

18141814
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
18151815
match self.pay_route_internal(&route, payment_hash, &recipient_onion_fields,
1816-
None, None, None, payment_id, None, &onion_session_privs, node_signer, best_block_height,
1817-
&send_payment_along_path
1816+
None, None, None, payment_id, None, &onion_session_privs, false, node_signer,
1817+
best_block_height, &send_payment_along_path
18181818
) {
18191819
Ok(()) => Ok((payment_hash, payment_id)),
18201820
Err(e) => {
@@ -2062,7 +2062,7 @@ where
20622062
&self, route: &Route, payment_hash: PaymentHash, recipient_onion: &RecipientOnionFields,
20632063
keysend_preimage: Option<PaymentPreimage>, invoice_request: Option<&InvoiceRequest>, bolt12_invoice: Option<&PaidBolt12Invoice>,
20642064
payment_id: PaymentId, recv_value_msat: Option<u64>, onion_session_privs: &Vec<[u8; 32]>,
2065-
node_signer: &NS, best_block_height: u32, send_payment_along_path: &F
2065+
hold_htlcs_at_next_hop: bool, node_signer: &NS, best_block_height: u32, send_payment_along_path: &F
20662066
) -> Result<(), PaymentSendFailure>
20672067
where
20682068
NS::Target: NodeSigner,
@@ -2185,7 +2185,7 @@ where
21852185
{
21862186
self.pay_route_internal(route, payment_hash, &recipient_onion,
21872187
keysend_preimage, None, None, payment_id, recv_value_msat, &onion_session_privs,
2188-
node_signer, best_block_height, &send_payment_along_path)
2188+
false, node_signer, best_block_height, &send_payment_along_path)
21892189
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
21902190
}
21912191

0 commit comments

Comments
 (0)