Skip to content

Commit 139cdd7

Browse files
committed
Test sending and receiving of user_custom_data
1 parent 64e4201 commit 139cdd7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lightning/src/ln/blinded_payment_tests.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ fn conditionally_round_fwd_amt() {
12881288

12891289

12901290
#[test]
1291-
fn sender_custom_tlvs_to_blinded_path() {
1291+
fn custom_tlvs_to_blinded_path() {
12921292
let chanmon_cfgs = create_chanmon_cfgs(2);
12931293
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
12941294
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
@@ -1304,7 +1304,7 @@ fn sender_custom_tlvs_to_blinded_path() {
13041304
htlc_minimum_msat: chan_upd.htlc_minimum_msat,
13051305
},
13061306
payment_context: PaymentContext::Bolt12Refund(Bolt12RefundContext {}),
1307-
custom_data: None,
1307+
custom_data: Some(vec![43, 43]),
13081308
};
13091309
let nonce = Nonce([42u8; 16]);
13101310
let expanded_key = chanmon_cfgs[1].keys_manager.get_inbound_payment_key();
@@ -1321,6 +1321,7 @@ fn sender_custom_tlvs_to_blinded_path() {
13211321
);
13221322

13231323
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty()
1324+
.with_user_custom_data(vec![43, 43])
13241325
.with_sender_custom_tlvs(vec![((1 << 16) + 1, vec![42, 42])])
13251326
.unwrap();
13261327
nodes[0].node.send_payment(payment_hash, recipient_onion_fields.clone(),
@@ -1333,11 +1334,13 @@ fn sender_custom_tlvs_to_blinded_path() {
13331334

13341335
let path = &[&nodes[1]];
13351336
let args = PassAlongPathArgs::new(&nodes[0], path, amt_msat, payment_hash, ev)
1337+
.with_user_custom_data(recipient_onion_fields.user_custom_data.clone().unwrap())
13361338
.with_payment_secret(payment_secret)
13371339
.with_sender_custom_tlvs(recipient_onion_fields.sender_custom_tlvs.clone());
13381340
do_pass_along_path(args);
13391341
claim_payment_along_route(
13401342
ClaimAlongRouteArgs::new(&nodes[0], &[&[&nodes[1]]], payment_preimage)
1343+
.with_user_custom_data(recipient_onion_fields.user_custom_data.clone().unwrap())
13411344
.with_sender_custom_tlvs(recipient_onion_fields.sender_custom_tlvs.clone())
13421345
);
13431346
}

lightning/src/ln/functional_test_utils.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,10 @@ impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
26962696
self.expected_preimage = Some(payment_preimage);
26972697
self
26982698
}
2699+
pub fn with_user_custom_data(mut self, custom_tlvs: Vec<u8>) -> Self {
2700+
self.user_custom_data = Some(custom_tlvs);
2701+
self
2702+
}
26992703
pub fn with_sender_custom_tlvs(mut self, sender_custom_tlvs: Vec<(u64, Vec<u8>)>) -> Self {
27002704
self.sender_custom_tlvs = sender_custom_tlvs;
27012705
self

0 commit comments

Comments
 (0)