Include RecipientOnionFields in PaymentClaimed
[rust-lightning] / lightning / src / ln / functional_test_utils.rs
index c5361318fca7c59ec5f726b228e1754c2dc2338c..cbb2b0f2197c18ef34490d703026cffa706853d2 100644 (file)
@@ -2535,6 +2535,7 @@ pub struct PassAlongPathArgs<'a, 'b, 'c, 'd> {
        pub expected_preimage: Option<PaymentPreimage>,
        pub is_probe: bool,
        pub custom_tlvs: Vec<(u64, Vec<u8>)>,
+       pub payment_metadata: Option<Vec<u8>>,
 }
 
 impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
@@ -2545,7 +2546,7 @@ impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
                Self {
                        origin_node, expected_path, recv_value, payment_hash, payment_secret: None, event,
                        payment_claimable_expected: true, clear_recipient_events: true, expected_preimage: None,
-                       is_probe: false, custom_tlvs: Vec::new(),
+                       is_probe: false, custom_tlvs: Vec::new(), payment_metadata: None,
                }
        }
        pub fn without_clearing_recipient_events(mut self) -> Self {
@@ -2573,13 +2574,17 @@ impl<'a, 'b, 'c, 'd> PassAlongPathArgs<'a, 'b, 'c, 'd> {
                self.custom_tlvs = custom_tlvs;
                self
        }
+       pub fn with_payment_metadata(mut self, payment_metadata: Vec<u8>) -> Self {
+               self.payment_metadata = Some(payment_metadata);
+               self
+       }
 }
 
 pub fn do_pass_along_path<'a, 'b, 'c>(args: PassAlongPathArgs) -> Option<Event> {
        let PassAlongPathArgs {
                origin_node, expected_path, recv_value, payment_hash: our_payment_hash,
                payment_secret: our_payment_secret, event: ev, payment_claimable_expected,
-               clear_recipient_events, expected_preimage, is_probe, custom_tlvs
+               clear_recipient_events, expected_preimage, is_probe, custom_tlvs, payment_metadata,
        } = args;
 
        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>
                                                assert_eq!(node.node.get_our_node_id(), receiver_node_id.unwrap());
                                                assert!(onion_fields.is_some());
                                                assert_eq!(onion_fields.as_ref().unwrap().custom_tlvs, custom_tlvs);
+                                               assert_eq!(onion_fields.as_ref().unwrap().payment_metadata, payment_metadata);
                                                match &purpose {
                                                        PaymentPurpose::Bolt11InvoicePayment { payment_preimage, payment_secret, .. } => {
                                                                assert_eq!(expected_preimage, *payment_preimage);