7
7
// You may not use this file except in accordance with one or both of these
8
8
// licenses.
9
9
10
- use crate :: blinded_path:: message:: { BlindedMessagePath , MessageContext , OffersContext } ;
10
+ use crate :: blinded_path:: message:: { MessageContext , OffersContext } ;
11
11
use crate :: events:: { Event , MessageSendEventsProvider , PaymentFailureReason } ;
12
12
use crate :: ln:: channelmanager:: PaymentId ;
13
13
use crate :: ln:: functional_test_utils:: * ;
14
- use crate :: ln:: msgs;
15
14
use crate :: ln:: msgs:: OnionMessageHandler ;
15
+ use crate :: ln:: offers_tests;
16
16
use crate :: ln:: outbound_payment:: Retry ;
17
17
use crate :: offers:: nonce:: Nonce ;
18
18
use crate :: onion_message:: async_payments:: {
19
19
AsyncPaymentsMessage , AsyncPaymentsMessageHandler , ReleaseHeldHtlc ,
20
20
} ;
21
- use crate :: onion_message:: messenger:: {
22
- Destination , MessageRouter , MessageSendInstructions , PeeledOnion ,
23
- } ;
21
+ use crate :: onion_message:: messenger:: { Destination , MessageRouter , MessageSendInstructions } ;
24
22
use crate :: onion_message:: offers:: OffersMessage ;
25
23
use crate :: onion_message:: packet:: ParsedOnionMessageContents ;
26
24
use crate :: prelude:: * ;
@@ -29,27 +27,6 @@ use bitcoin::secp256k1::Secp256k1;
29
27
30
28
use core:: convert:: Infallible ;
31
29
32
- #[ cfg( async_payments) ]
33
- fn extract_invoice_request_reply_path < ' a , ' b , ' c > (
34
- invreq_recipient : & Node < ' a , ' b , ' c > , message : & msgs:: OnionMessage ,
35
- ) -> BlindedMessagePath {
36
- match invreq_recipient. onion_messenger . peel_onion_message ( message) {
37
- Ok ( PeeledOnion :: Receive ( invreq, context, reply_path) ) => {
38
- assert ! ( matches!(
39
- invreq,
40
- ParsedOnionMessageContents :: Offers ( OffersMessage :: InvoiceRequest ( _) )
41
- ) ) ;
42
- assert ! ( matches!(
43
- context,
44
- Some ( MessageContext :: Offers ( OffersContext :: InvoiceRequest { .. } ) )
45
- ) ) ;
46
- reply_path. unwrap ( )
47
- } ,
48
- Ok ( PeeledOnion :: Forward ( _, _) ) => panic ! ( "Unexpected onion message forward" ) ,
49
- Err ( e) => panic ! ( "Failed to process onion message {:?}" , e) ,
50
- }
51
- }
52
-
53
30
#[ test]
54
31
#[ cfg( async_payments) ]
55
32
fn static_invoice_unknown_required_features ( ) {
@@ -97,7 +74,7 @@ fn static_invoice_unknown_required_features() {
97
74
. onion_messenger
98
75
. next_onion_message_for_peer ( nodes[ 1 ] . node . get_our_node_id ( ) )
99
76
. unwrap ( ) ;
100
- let invreq_reply_path = extract_invoice_request_reply_path ( & nodes[ 1 ] , & invreq_om) ;
77
+ let invreq_reply_path = offers_tests :: extract_invoice_request ( & nodes[ 1 ] , & invreq_om) . 1 ;
101
78
nodes[ 1 ]
102
79
. onion_messenger
103
80
. send_onion_message (
@@ -169,7 +146,7 @@ fn ignore_unexpected_static_invoice() {
169
146
. onion_messenger
170
147
. next_onion_message_for_peer ( nodes[ 1 ] . node . get_our_node_id ( ) )
171
148
. unwrap ( ) ;
172
- let invreq_reply_path = extract_invoice_request_reply_path ( & nodes[ 1 ] , & invreq_om) ;
149
+ let invreq_reply_path = offers_tests :: extract_invoice_request ( & nodes[ 1 ] , & invreq_om) . 1 ;
173
150
174
151
// Create a static invoice to be sent over the reply path containing the original payment_id, but
175
152
// the static invoice corresponds to a different offer than was originally paid.
@@ -313,7 +290,7 @@ fn pays_static_invoice() {
313
290
. onion_messenger
314
291
. next_onion_message_for_peer ( nodes[ 1 ] . node . get_our_node_id ( ) )
315
292
. unwrap ( ) ;
316
- let invreq_reply_path = extract_invoice_request_reply_path ( & nodes[ 1 ] , & invreq_om) ;
293
+ let invreq_reply_path = offers_tests :: extract_invoice_request ( & nodes[ 1 ] , & invreq_om) . 1 ;
317
294
318
295
nodes[ 1 ]
319
296
. onion_messenger
0 commit comments