]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Unwrap reply_path in extract_invoice_request
authorJeffrey Czyz <jkczyz@gmail.com>
Wed, 10 Apr 2024 21:07:58 +0000 (16:07 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 28 May 2024 21:35:55 +0000 (16:35 -0500)
lightning/src/ln/offers_tests.rs

index 6ae87e6001d409e7f4ec08e7d1a0b439079ed752..6484f5259f6dd99b9eb0025801cfe4b773ae5c79 100644 (file)
@@ -178,11 +178,11 @@ fn claim_bolt12_payment<'a, 'b, 'c>(
 
 fn extract_invoice_request<'a, 'b, 'c>(
        node: &Node<'a, 'b, 'c>, message: &OnionMessage
-) -> (InvoiceRequest, Option<BlindedPath>) {
+) -> (InvoiceRequest, BlindedPath) {
        match node.onion_messenger.peel_onion_message(message) {
                Ok(PeeledOnion::Receive(message, _, reply_path)) => match message {
                        ParsedOnionMessageContents::Offers(offers_message) => match offers_message {
-                               OffersMessage::InvoiceRequest(invoice_request) => (invoice_request, reply_path),
+                               OffersMessage::InvoiceRequest(invoice_request) => (invoice_request, reply_path.unwrap()),
                                OffersMessage::Invoice(invoice) => panic!("Unexpected invoice: {:?}", invoice),
                                OffersMessage::InvoiceError(error) => panic!("Unexpected invoice_error: {:?}", error),
                        },
@@ -417,7 +417,7 @@ fn creates_and_pays_for_offer_using_two_hop_blinded_path() {
        });
        assert_eq!(invoice_request.amount_msats(), None);
        assert_ne!(invoice_request.payer_id(), david_id);
-       assert_eq!(reply_path.unwrap().introduction_node, IntroductionNode::NodeId(charlie_id));
+       assert_eq!(reply_path.introduction_node, IntroductionNode::NodeId(charlie_id));
 
        let onion_message = alice.onion_messenger.next_onion_message_for_peer(charlie_id).unwrap();
        charlie.onion_messenger.handle_onion_message(&alice_id, &onion_message);
@@ -566,7 +566,7 @@ fn creates_and_pays_for_offer_using_one_hop_blinded_path() {
        });
        assert_eq!(invoice_request.amount_msats(), None);
        assert_ne!(invoice_request.payer_id(), bob_id);
-       assert_eq!(reply_path.unwrap().introduction_node, IntroductionNode::NodeId(bob_id));
+       assert_eq!(reply_path.introduction_node, IntroductionNode::NodeId(bob_id));
 
        let onion_message = alice.onion_messenger.next_onion_message_for_peer(bob_id).unwrap();
        bob.onion_messenger.handle_onion_message(&alice_id, &onion_message);