Skip to content

Commit 2ae4109

Browse files
Test utils: include payment_metadata in PassAlongPathArgs.
1 parent 9fd4af8 commit 2ae4109

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,6 +2535,7 @@ pub struct PassAlongPathArgs<'a, 'b, 'c, 'd> {
25352535
pub expected_preimage: Option<PaymentPreimage>,
25362536
pub is_probe: bool,
25372537
pub custom_tlvs: Vec<(u64, Vec<u8>)>,
2538+
pub payment_metadata: Option<Vec<u8>>,
25382539
}
25392540

25402541
impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
@@ -2545,7 +2546,7 @@ impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
25452546
Self {
25462547
origin_node, expected_path, recv_value, payment_hash, payment_secret: None, event,
25472548
payment_claimable_expected: true, clear_recipient_events: true, expected_preimage: None,
2548-
is_probe: false, custom_tlvs: Vec::new(),
2549+
is_probe: false, custom_tlvs: Vec::new(), payment_metadata: None,
25492550
}
25502551
}
25512552
pub fn without_clearing_recipient_events(mut self) -> Self {
@@ -2573,13 +2574,17 @@ impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
25732574
self.custom_tlvs = custom_tlvs;
25742575
self
25752576
}
2577+
pub fn with_payment_metadata(mut self, payment_metadata: Vec<u8>) -> Self {
2578+
self.payment_metadata = Some(payment_metadata);
2579+
self
2580+
}
25762581
}
25772582

25782583
pub fn do_pass_along_path<'a, 'b, 'c>(args: PassAlongPathArgs) -> Option<Event> {
25792584
let PassAlongPathArgs {
25802585
origin_node, expected_path, recv_value, payment_hash: our_payment_hash,
25812586
payment_secret: our_payment_secret, event: ev, payment_claimable_expected,
2582-
clear_recipient_events, expected_preimage, is_probe, custom_tlvs
2587+
clear_recipient_events, expected_preimage, is_probe, custom_tlvs, payment_metadata,
25832588
} = args;
25842589

25852590
let mut payment_event = SendEvent::from_event(ev);
@@ -2613,6 +2618,7 @@ pub fn do_pass_along_path<'a, 'b, 'c>(args: PassAlongPathArgs) -> Option<Event>
26132618
assert_eq!(node.node.get_our_node_id(), receiver_node_id.unwrap());
26142619
assert!(onion_fields.is_some());
26152620
assert_eq!(onion_fields.as_ref().unwrap().custom_tlvs, custom_tlvs);
2621+
assert_eq!(onion_fields.as_ref().unwrap().payment_metadata, payment_metadata);
26162622
match &purpose {
26172623
PaymentPurpose::Bolt11InvoicePayment { payment_preimage, payment_secret, .. } => {
26182624
assert_eq!(expected_preimage, *payment_preimage);

0 commit comments

Comments
 (0)