Skip to content

Commit a130bd6

Browse files
authored
Merge pull request #3207 from valentinewallace/2024-07-invreq-in-onion
Include invoice requests in async payment onions
2 parents ef0f35a + 240dd0a commit a130bd6

17 files changed

+178
-95
lines changed

fuzz/src/onion_message.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,16 @@ impl OffersMessageHandler for TestOffersMessageHandler {
121121
struct TestAsyncPaymentsMessageHandler {}
122122

123123
impl AsyncPaymentsMessageHandler for TestAsyncPaymentsMessageHandler {
124-
fn held_htlc_available(
125-
&self, message: HeldHtlcAvailable, responder: Option<Responder>,
124+
fn handle_held_htlc_available(
125+
&self, _message: HeldHtlcAvailable, responder: Option<Responder>,
126126
) -> Option<(ReleaseHeldHtlc, ResponseInstruction)> {
127127
let responder = match responder {
128128
Some(resp) => resp,
129129
None => return None,
130130
};
131131
Some((ReleaseHeldHtlc {}, responder.respond()))
132132
}
133-
fn release_held_htlc(&self, _message: ReleaseHeldHtlc, _context: AsyncPaymentsContext) {}
133+
fn handle_release_held_htlc(&self, _message: ReleaseHeldHtlc, _context: AsyncPaymentsContext) {}
134134
}
135135

136136
#[derive(Debug)]

lightning/src/events/mod.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,15 @@ pub enum PaymentFailureReason {
560560
/// [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
561561
/// [`InvoiceRequestExpired`]: Self::InvoiceRequestExpired
562562
PaymentExpired,
563-
/// We failed to find a route while retrying the payment.
563+
/// We failed to find a route while sending or retrying the payment.
564564
///
565565
/// Note that this generally indicates that we've exhausted the available set of possible
566566
/// routes - we tried the payment over a few routes but were not able to find any further
567567
/// candidate routes beyond those.
568+
///
569+
/// Also used for [`BlindedPathCreationFailed`] when downgrading to versions prior to 0.0.124.
570+
///
571+
/// [`BlindedPathCreationFailed`]: Self::BlindedPathCreationFailed
568572
RouteNotFound,
569573
/// This error should generally never happen. This likely means that there is a problem with
570574
/// your router.
@@ -577,6 +581,12 @@ pub enum PaymentFailureReason {
577581
///
578582
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
579583
InvoiceRequestRejected,
584+
/// Failed to create a blinded path back to ourselves.
585+
/// We attempted to initiate payment to a static invoice but failed to create a reply path for our
586+
/// [`HeldHtlcAvailable`] message.
587+
///
588+
/// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable
589+
BlindedPathCreationFailed,
580590
}
581591

582592
impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
@@ -587,6 +597,7 @@ impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
587597
(4, RetriesExhausted) => {},
588598
(5, InvoiceRequestRejected) => {},
589599
(6, PaymentExpired) => {},
600+
(7, BlindedPathCreationFailed) => {},
590601
(8, RouteNotFound) => {},
591602
(10, UnexpectedError) => {},
592603
);
@@ -1651,6 +1662,8 @@ impl Writeable for Event {
16511662
&Some(PaymentFailureReason::RetriesExhausted),
16521663
Some(PaymentFailureReason::InvoiceRequestRejected) =>
16531664
&Some(PaymentFailureReason::RecipientRejected),
1665+
Some(PaymentFailureReason::BlindedPathCreationFailed) =>
1666+
&Some(PaymentFailureReason::RouteNotFound)
16541667
};
16551668
write_tlv_fields!(writer, {
16561669
(0, payment_id, required),

lightning/src/ln/blinded_payment_tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
318318
let onion_keys = onion_utils::construct_onion_keys(&Secp256k1::new(), &route.paths[0], &session_priv).unwrap();
319319
let cur_height = nodes[0].best_block_info().1;
320320
let (mut onion_payloads, ..) = onion_utils::build_onion_payloads(
321-
&route.paths[0], amt_msat, &recipient_onion_fields, cur_height, &None).unwrap();
321+
&route.paths[0], amt_msat, &recipient_onion_fields, cur_height, &None, None).unwrap();
322322
// Remove the receive payload so the blinded forward payload is encoded as a final payload
323323
// (i.e. next_hop_hmac == [0; 32])
324324
onion_payloads.pop();
@@ -897,7 +897,7 @@ fn do_multi_hop_receiver_fail(check: ReceiveCheckFail) {
897897
let cur_height = nodes[0].best_block_info().1;
898898
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
899899
let (mut onion_payloads, ..) = onion_utils::build_onion_payloads(
900-
&route.paths[0], amt_msat, &recipient_onion_fields, cur_height, &None).unwrap();
900+
&route.paths[0], amt_msat, &recipient_onion_fields, cur_height, &None, None).unwrap();
901901

902902
let update_add = &mut payment_event_1_2.msgs[0];
903903
onion_payloads.last_mut().map(|p| {
@@ -1447,7 +1447,7 @@ fn route_blinding_spec_test_vector() {
14471447
}),
14481448
};
14491449
let cur_height = 747_000;
1450-
let (bob_onion, _, _) = onion_utils::create_payment_onion(&secp_ctx, &path, &session_priv, amt_msat, &RecipientOnionFields::spontaneous_empty(), cur_height, &PaymentHash([0; 32]), &None, [0; 32]).unwrap();
1450+
let (bob_onion, _, _) = onion_utils::create_payment_onion(&secp_ctx, &path, &session_priv, amt_msat, &RecipientOnionFields::spontaneous_empty(), cur_height, &PaymentHash([0; 32]), &None, None, [0; 32]).unwrap();
14511451

14521452
struct TestEcdhSigner {
14531453
node_secret: SecretKey,

lightning/src/ln/channelmanager.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4306,14 +4306,14 @@ where
43064306
let _lck = self.total_consistency_lock.read().unwrap();
43074307
self.send_payment_along_path(SendAlongPathArgs {
43084308
path, payment_hash, recipient_onion: &recipient_onion, total_value,
4309-
cur_height, payment_id, keysend_preimage, session_priv_bytes
4309+
cur_height, payment_id, keysend_preimage, invoice_request: None, session_priv_bytes
43104310
})
43114311
}
43124312

43134313
fn send_payment_along_path(&self, args: SendAlongPathArgs) -> Result<(), APIError> {
43144314
let SendAlongPathArgs {
43154315
path, payment_hash, recipient_onion, total_value, cur_height, payment_id, keysend_preimage,
4316-
session_priv_bytes
4316+
invoice_request, session_priv_bytes
43174317
} = args;
43184318
// The top-level caller should hold the total_consistency_lock read lock.
43194319
debug_assert!(self.total_consistency_lock.try_write().is_err());
@@ -4322,7 +4322,7 @@ where
43224322

43234323
let (onion_packet, htlc_msat, htlc_cltv) = onion_utils::create_payment_onion(
43244324
&self.secp_ctx, &path, &session_priv, total_value, recipient_onion, cur_height,
4325-
payment_hash, keysend_preimage, prng_seed
4325+
payment_hash, keysend_preimage, invoice_request, prng_seed
43264326
).map_err(|e| {
43274327
let logger = WithContext::from(&self.logger, Some(path.hops.first().unwrap().pubkey), None, Some(*payment_hash));
43284328
log_error!(logger, "Failed to build an onion for path for payment hash {}", payment_hash);
@@ -4590,7 +4590,7 @@ where
45904590
) {
45914591
Ok(paths) => paths,
45924592
Err(()) => {
4593-
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::RouteNotFound);
4593+
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::BlindedPathCreationFailed);
45944594
res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
45954595
return NotifyOption::DoPersist
45964596
}
@@ -11474,13 +11474,13 @@ where
1147411474
MR::Target: MessageRouter,
1147511475
L::Target: Logger,
1147611476
{
11477-
fn held_htlc_available(
11477+
fn handle_held_htlc_available(
1147811478
&self, _message: HeldHtlcAvailable, _responder: Option<Responder>
1147911479
) -> Option<(ReleaseHeldHtlc, ResponseInstruction)> {
1148011480
None
1148111481
}
1148211482

11483-
fn release_held_htlc(&self, _message: ReleaseHeldHtlc, _context: AsyncPaymentsContext) {
11483+
fn handle_release_held_htlc(&self, _message: ReleaseHeldHtlc, _context: AsyncPaymentsContext) {
1148411484
#[cfg(async_payments)] {
1148511485
let AsyncPaymentsContext::OutboundPayment { payment_id, hmac, nonce } = _context;
1148611486
if payment_id.verify_for_async_payment(hmac, nonce, &self.inbound_payment_key).is_err() { return }

lightning/src/ln/functional_tests.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ fn test_fee_spike_violation_fails_htlc() {
14381438
let onion_keys = onion_utils::construct_onion_keys(&secp_ctx, &route.paths[0], &session_priv).unwrap();
14391439
let recipient_onion_fields = RecipientOnionFields::secret_only(payment_secret);
14401440
let (onion_payloads, htlc_msat, htlc_cltv) = onion_utils::build_onion_payloads(&route.paths[0],
1441-
3460001, &recipient_onion_fields, cur_height, &None).unwrap();
1441+
3460001, &recipient_onion_fields, cur_height, &None, None).unwrap();
14421442
let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &payment_hash).unwrap();
14431443
let msg = msgs::UpdateAddHTLC {
14441444
channel_id: chan.2,
@@ -1637,7 +1637,7 @@ fn test_chan_reserve_violation_inbound_htlc_outbound_channel() {
16371637
let onion_keys = onion_utils::construct_onion_keys(&secp_ctx, &route.paths[0], &session_priv).unwrap();
16381638
let recipient_onion_fields = RecipientOnionFields::secret_only(payment_secret);
16391639
let (onion_payloads, htlc_msat, htlc_cltv) = onion_utils::build_onion_payloads(&route.paths[0],
1640-
700_000, &recipient_onion_fields, cur_height, &None).unwrap();
1640+
700_000, &recipient_onion_fields, cur_height, &None, None).unwrap();
16411641
let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &payment_hash).unwrap();
16421642
let msg = msgs::UpdateAddHTLC {
16431643
channel_id: chan.2,
@@ -1817,7 +1817,7 @@ fn test_chan_reserve_violation_inbound_htlc_inbound_chan() {
18171817
let onion_keys = onion_utils::construct_onion_keys(&secp_ctx, &route_2.paths[0], &session_priv).unwrap();
18181818
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
18191819
let (onion_payloads, htlc_msat, htlc_cltv) = onion_utils::build_onion_payloads(
1820-
&route_2.paths[0], recv_value_2, &recipient_onion_fields, cur_height, &None).unwrap();
1820+
&route_2.paths[0], recv_value_2, &recipient_onion_fields, cur_height, &None, None).unwrap();
18211821
let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &our_payment_hash_1).unwrap();
18221822
let msg = msgs::UpdateAddHTLC {
18231823
channel_id: chan.2,
@@ -3556,7 +3556,7 @@ fn fail_backward_pending_htlc_upon_channel_failure() {
35563556
let current_height = nodes[1].node.best_block.read().unwrap().height + 1;
35573557
let recipient_onion_fields = RecipientOnionFields::secret_only(payment_secret);
35583558
let (onion_payloads, _amount_msat, cltv_expiry) = onion_utils::build_onion_payloads(
3559-
&route.paths[0], 50_000, &recipient_onion_fields, current_height, &None).unwrap();
3559+
&route.paths[0], 50_000, &recipient_onion_fields, current_height, &None, None).unwrap();
35603560
let onion_keys = onion_utils::construct_onion_keys(&secp_ctx, &route.paths[0], &session_priv).unwrap();
35613561
let onion_routing_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &payment_hash).unwrap();
35623562

@@ -6551,7 +6551,7 @@ fn test_update_add_htlc_bolt2_receiver_check_max_htlc_limit() {
65516551
let onion_keys = onion_utils::construct_onion_keys(&Secp256k1::signing_only(), &route.paths[0], &session_priv).unwrap();
65526552
let recipient_onion_fields = RecipientOnionFields::secret_only(our_payment_secret);
65536553
let (onion_payloads, _htlc_msat, htlc_cltv) = onion_utils::build_onion_payloads(
6554-
&route.paths[0], send_amt, &recipient_onion_fields, cur_height, &None).unwrap();
6554+
&route.paths[0], send_amt, &recipient_onion_fields, cur_height, &None, None).unwrap();
65556555
let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &our_payment_hash).unwrap();
65566556

65576557
let mut msg = msgs::UpdateAddHTLC {
@@ -8294,7 +8294,7 @@ fn test_onion_value_mpp_set_calculation() {
82948294
let mut onion_keys = onion_utils::construct_onion_keys(&Secp256k1::new(), &route.paths[0], &session_priv).unwrap();
82958295
let recipient_onion_fields = RecipientOnionFields::secret_only(our_payment_secret);
82968296
let (mut onion_payloads, _, _) = onion_utils::build_onion_payloads(&route.paths[0], 100_000,
8297-
&recipient_onion_fields, height + 1, &None).unwrap();
8297+
&recipient_onion_fields, height + 1, &None, None).unwrap();
82988298
// Edit amt_to_forward to simulate the sender having set
82998299
// the final amount and the routing node taking less fee
83008300
if let msgs::OutboundOnionPayload::Receive {

lightning/src/ln/max_payment_path_len_tests.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn large_payment_metadata() {
110110
let secp_ctx = Secp256k1::signing_only();
111111
route_0_1.paths[0].hops[0].fee_msat = MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY;
112112
route_0_1.paths[0].hops[0].cltv_expiry_delta = DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
113-
let err = onion_utils::create_payment_onion(&secp_ctx, &route_0_1.paths[0], &test_utils::privkey(42), MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY, &recipient_onion_too_large_md, nodes[0].best_block_info().1 + DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA, &payment_hash, &None, [0; 32]).unwrap_err();
113+
let err = onion_utils::create_payment_onion(&secp_ctx, &route_0_1.paths[0], &test_utils::privkey(42), MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY, &recipient_onion_too_large_md, nodes[0].best_block_info().1 + DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA, &payment_hash, &None, None, [0; 32]).unwrap_err();
114114
match err {
115115
APIError::InvalidRoute { err } => {
116116
assert_eq!(err, "Route size too large considering onion data");
@@ -184,6 +184,7 @@ fn one_hop_blinded_path_with_custom_tlv() {
184184
encrypted_tlvs: &blinded_path.blinded_hops()[0].encrypted_payload,
185185
intro_node_blinding_point: Some(blinded_path.blinding_point()),
186186
keysend_preimage: None,
187+
invoice_request: None,
187188
custom_tlvs: &Vec::new()
188189
}.serialized_length();
189190
let max_custom_tlv_len = 1300
@@ -275,7 +276,7 @@ fn blinded_path_with_custom_tlv() {
275276
let reserved_packet_bytes_without_custom_tlv: usize = onion_utils::build_onion_payloads(
276277
&route.paths[0], MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY,
277278
&RecipientOnionFields::spontaneous_empty(),
278-
nodes[0].best_block_info().1 + DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA, &None
279+
nodes[0].best_block_info().1 + DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA, &None, None
279280
)
280281
.unwrap()
281282
.0
@@ -317,7 +318,7 @@ fn blinded_path_with_custom_tlv() {
317318
let secp_ctx = Secp256k1::signing_only();
318319
route.paths[0].hops[0].fee_msat = MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY;
319320
route.paths[0].hops[0].cltv_expiry_delta = DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
320-
let err = onion_utils::create_payment_onion(&secp_ctx, &route.paths[0], &test_utils::privkey(42), MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY, &recipient_onion_too_large_custom_tlv, nodes[0].best_block_info().1 + DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA, &payment_hash, &None, [0; 32]).unwrap_err();
321+
let err = onion_utils::create_payment_onion(&secp_ctx, &route.paths[0], &test_utils::privkey(42), MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY, &recipient_onion_too_large_custom_tlv, nodes[0].best_block_info().1 + DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA, &payment_hash, &None, None, [0; 32]).unwrap_err();
321322
match err {
322323
APIError::InvalidRoute { err } => {
323324
assert_eq!(err, "Route size too large considering onion data");

lightning/src/ln/msgs.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,7 @@ pub struct FinalOnionHopData {
17471747
mod fuzzy_internal_msgs {
17481748
use bitcoin::secp256k1::PublicKey;
17491749
use crate::blinded_path::payment::{BlindedPaymentPath, PaymentConstraints, PaymentContext, PaymentRelay};
1750+
use crate::offers::invoice_request::InvoiceRequest;
17501751
use crate::types::payment::{PaymentPreimage, PaymentSecret};
17511752
use crate::types::features::{BlindedHopFeatures, Bolt12InvoiceFeatures};
17521753
use super::{FinalOnionHopData, TrampolineOnionPacket};
@@ -1827,6 +1828,7 @@ mod fuzzy_internal_msgs {
18271828
intro_node_blinding_point: Option<PublicKey>, // Set if the introduction node of the blinded path is the final node
18281829
keysend_preimage: Option<PaymentPreimage>,
18291830
custom_tlvs: &'a Vec<(u64, Vec<u8>)>,
1831+
invoice_request: Option<&'a InvoiceRequest>,
18301832
}
18311833
}
18321834

@@ -2760,13 +2762,17 @@ impl<'a> Writeable for OutboundOnionPayload<'a> {
27602762
},
27612763
Self::BlindedReceive {
27622764
sender_intended_htlc_amt_msat, total_msat, cltv_expiry_height, encrypted_tlvs,
2763-
intro_node_blinding_point, keysend_preimage, ref custom_tlvs,
2765+
intro_node_blinding_point, keysend_preimage, ref invoice_request, ref custom_tlvs,
27642766
} => {
27652767
// We need to update [`ln::outbound_payment::RecipientOnionFields::with_custom_tlvs`]
27662768
// to reject any reserved types in the experimental range if new ones are ever
27672769
// standardized.
2770+
let invoice_request_tlv = invoice_request.map(|invreq| (77_777, invreq.encode())); // TODO: update TLV type once the async payments spec is merged
27682771
let keysend_tlv = keysend_preimage.map(|preimage| (5482373484, preimage.encode()));
2769-
let mut custom_tlvs: Vec<&(u64, Vec<u8>)> = custom_tlvs.iter().chain(keysend_tlv.iter()).collect();
2772+
let mut custom_tlvs: Vec<&(u64, Vec<u8>)> = custom_tlvs.iter()
2773+
.chain(invoice_request_tlv.iter())
2774+
.chain(keysend_tlv.iter())
2775+
.collect();
27702776
custom_tlvs.sort_unstable_by_key(|(typ, _)| *typ);
27712777
_encode_varint_length_prefixed_tlv!(w, {
27722778
(2, HighZeroBytesDroppedBigSize(*sender_intended_htlc_amt_msat), required),

lightning/src/ln/onion_payment.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ mod tests {
541541
let path = Path { hops, blinded_tail: None, };
542542
let onion_keys = super::onion_utils::construct_onion_keys(&secp_ctx, &path, &session_priv).unwrap();
543543
let (onion_payloads, ..) = super::onion_utils::build_onion_payloads(
544-
&path, total_amt_msat, &recipient_onion, cur_height + 1, &Some(keysend_preimage)
544+
&path, total_amt_msat, &recipient_onion, cur_height + 1, &Some(keysend_preimage), None
545545
).unwrap();
546546

547547
assert!(super::onion_utils::construct_onion_packet(
@@ -569,7 +569,7 @@ mod tests {
569569

570570
let (onion, amount_msat, cltv_expiry) = create_payment_onion(
571571
&secp_ctx, &path, &session_priv, total_amt_msat, &recipient_onion,
572-
cur_height, &payment_hash, &Some(preimage), prng_seed
572+
cur_height, &payment_hash, &Some(preimage), None, prng_seed
573573
).unwrap();
574574

575575
let msg = make_update_add_msg(amount_msat, cltv_expiry, payment_hash, onion);

lightning/src/ln/onion_route_tests.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ fn test_onion_failure() {
356356
let onion_keys = onion_utils::construct_onion_keys(&Secp256k1::new(), &route.paths[0], &session_priv).unwrap();
357357
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
358358
let (mut onion_payloads, _htlc_msat, _htlc_cltv) = onion_utils::build_onion_payloads(
359-
&route.paths[0], 40000, &recipient_onion_fields, cur_height, &None).unwrap();
359+
&route.paths[0], 40000, &recipient_onion_fields, cur_height, &None, None).unwrap();
360360
let mut new_payloads = Vec::new();
361361
for payload in onion_payloads.drain(..) {
362362
new_payloads.push(BogusOnionHopData::new(payload));
@@ -375,7 +375,7 @@ fn test_onion_failure() {
375375
let onion_keys = onion_utils::construct_onion_keys(&Secp256k1::new(), &route.paths[0], &session_priv).unwrap();
376376
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
377377
let (mut onion_payloads, _htlc_msat, _htlc_cltv) = onion_utils::build_onion_payloads(
378-
&route.paths[0], 40000, &recipient_onion_fields, cur_height, &None).unwrap();
378+
&route.paths[0], 40000, &recipient_onion_fields, cur_height, &None, None).unwrap();
379379
let mut new_payloads = Vec::new();
380380
for payload in onion_payloads.drain(..) {
381381
new_payloads.push(BogusOnionHopData::new(payload));
@@ -627,7 +627,7 @@ fn test_onion_failure() {
627627
let onion_keys = onion_utils::construct_onion_keys(&Secp256k1::new(), &route.paths[0], &session_priv).unwrap();
628628
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
629629
let (onion_payloads, _, htlc_cltv) = onion_utils::build_onion_payloads(
630-
&route.paths[0], 40000, &recipient_onion_fields, height, &None).unwrap();
630+
&route.paths[0], 40000, &recipient_onion_fields, height, &None, None).unwrap();
631631
let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &payment_hash).unwrap();
632632
msg.cltv_expiry = htlc_cltv;
633633
msg.onion_routing_packet = onion_packet;
@@ -964,7 +964,7 @@ fn test_always_create_tlv_format_onion_payloads() {
964964
let cur_height = nodes[0].best_block_info().1 + 1;
965965
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
966966
let (onion_payloads, _htlc_msat, _htlc_cltv) = onion_utils::build_onion_payloads(
967-
&route.paths[0], 40000, &recipient_onion_fields, cur_height, &None).unwrap();
967+
&route.paths[0], 40000, &recipient_onion_fields, cur_height, &None, None).unwrap();
968968

969969
match onion_payloads[0] {
970970
msgs::OutboundOnionPayload::Forward {..} => {},
@@ -1221,7 +1221,7 @@ fn test_phantom_invalid_onion_payload() {
12211221
let recipient_onion_fields = RecipientOnionFields::secret_only(payment_secret);
12221222
let (mut onion_payloads, _, _) = onion_utils::build_onion_payloads(
12231223
&route.paths[0], msgs::MAX_VALUE_MSAT + 1,
1224-
&recipient_onion_fields, height + 1, &None).unwrap();
1224+
&recipient_onion_fields, height + 1, &None, None).unwrap();
12251225
// We only want to construct the onion packet for the last hop, not the entire route, so
12261226
// remove the first hop's payload and its keys.
12271227
onion_keys.remove(0);

0 commit comments

Comments
 (0)