diff --git a/lightning/src/ln/blinded_payment_tests.rs b/lightning/src/ln/blinded_payment_tests.rs index 2a1ae8f00c0..192d021201b 100644 --- a/lightning/src/ln/blinded_payment_tests.rs +++ b/lightning/src/ln/blinded_payment_tests.rs @@ -1313,7 +1313,7 @@ fn custom_tlvs_to_blinded_path() { htlc_minimum_msat: chan_upd.htlc_minimum_msat, }, payment_context: PaymentContext::unknown(), - custom_tlvs: Vec::new(), + custom_tlvs: vec![43, 43] }; let mut secp_ctx = Secp256k1::new(); let blinded_path = BlindedPaymentPath::new( @@ -1327,6 +1327,7 @@ fn custom_tlvs_to_blinded_path() { ); let recipient_onion_fields = RecipientOnionFields::spontaneous_empty() + .with_user_custom_tlvs(vec![43, 43]) .with_sender_custom_tlvs(vec![((1 << 16) + 3, vec![42, 42])]) .unwrap(); nodes[0].node.send_payment(payment_hash, recipient_onion_fields.clone(), @@ -1340,10 +1341,12 @@ fn custom_tlvs_to_blinded_path() { let path = &[&nodes[1]]; let args = PassAlongPathArgs::new(&nodes[0], path, amt_msat, payment_hash, ev) .with_payment_secret(payment_secret) + .with_user_custom_tlvs(recipient_onion_fields.user_custom_tlvs.clone()) .with_sender_custom_tlvs(recipient_onion_fields.sender_custom_tlvs.clone()); do_pass_along_path(args); claim_payment_along_route( ClaimAlongRouteArgs::new(&nodes[0], &[&[&nodes[1]]], payment_preimage) + .with_user_custom_tlvs(recipient_onion_fields.user_custom_tlvs.clone()) .with_sender_custom_tlvs(recipient_onion_fields.sender_custom_tlvs.clone()) ); } diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs index 5a8b22d2543..23d90bb8448 100644 --- a/lightning/src/ln/functional_test_utils.rs +++ b/lightning/src/ln/functional_test_utils.rs @@ -2828,6 +2828,10 @@ impl<'a, 'b, 'c, 'd> ClaimAlongRouteArgs<'a, 'b, 'c, 'd> { self.allow_1_msat_fee_overpay = true; self } + pub fn with_user_custom_tlvs(mut self, custom_tlvs: Vec) -> Self { + self.user_custom_tlvs = custom_tlvs; + self + } pub fn with_sender_custom_tlvs(mut self, custom_tlvs: Vec<(u64, Vec)>) -> Self { self.sender_custom_tlvs = custom_tlvs; self diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index 46a45356d55..265b0ca52f9 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -659,6 +659,11 @@ impl RecipientOnionFields { Ok(self) } + pub fn with_user_custom_tlvs(mut self, custom_tlvs: Vec) -> Self { + self.user_custom_tlvs = custom_tlvs; + self + } + /// Gets the custom TLVs that will be sent or have been received. /// /// Custom TLVs allow sending extra application-specific data with a payment. They provide diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index 0f60a0fbd4c..60511edc852 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -3787,8 +3787,12 @@ fn test_retry_custom_tlvs() { let mut route_params = route.route_params.clone().unwrap(); let sender_custom_tlvs = vec![((1 << 16) + 3, vec![0x42u8; 16])]; + let user_custom_tlvs = vec![0x43u8; 16]; let onion_fields = RecipientOnionFields::secret_only(payment_secret); - let onion_fields = onion_fields.with_sender_custom_tlvs(sender_custom_tlvs.clone()).unwrap(); + let onion_fields = onion_fields + .with_user_custom_tlvs(user_custom_tlvs.clone()) + .with_sender_custom_tlvs(sender_custom_tlvs.clone()) + .unwrap(); nodes[0].router.expect_find_route(route_params.clone(), Ok(route.clone())); nodes[0].node.send_payment(payment_hash, onion_fields, @@ -3840,10 +3844,12 @@ fn test_retry_custom_tlvs() { let path = &[&nodes[1], &nodes[2]]; let args = PassAlongPathArgs::new(&nodes[0], path, 1_000_000, payment_hash, events.pop().unwrap()) .with_payment_secret(payment_secret) + .with_user_custom_tlvs(user_custom_tlvs.clone()) .with_sender_custom_tlvs(sender_custom_tlvs.clone()); do_pass_along_path(args); claim_payment_along_route( ClaimAlongRouteArgs::new(&nodes[0], &[&[&nodes[1], &nodes[2]]], payment_preimage) + .with_user_custom_tlvs(user_custom_tlvs) .with_sender_custom_tlvs(sender_custom_tlvs) ); }