@@ -261,6 +261,53 @@ fn extract_invoice_error<'a, 'b, 'c>(
261
261
}
262
262
}
263
263
264
+ /// Checks that an offer can be created with no blinded paths.
265
+ #[ test]
266
+ fn create_offer_with_no_blinded_path ( ) {
267
+ let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
268
+ let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
269
+ let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
270
+ let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
271
+
272
+ create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 10_000_000 , 1_000_000_000 ) ;
273
+
274
+ let alice = & nodes[ 0 ] ;
275
+ let alice_id = alice. node . get_our_node_id ( ) ;
276
+
277
+ let offer = alice. node
278
+ . create_offer_builder ( None ) . unwrap ( )
279
+ . amount_msats ( 10_000_000 )
280
+ . build ( ) . unwrap ( ) ;
281
+ assert_eq ! ( offer. issuer_signing_pubkey( ) , Some ( alice_id) ) ;
282
+ assert ! ( offer. paths( ) . is_empty( ) ) ;
283
+ }
284
+
285
+ /// Checks that a refund can be created with no blinded paths.
286
+ #[ test]
287
+ fn create_refund_with_no_blinded_path ( ) {
288
+ let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
289
+ let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
290
+ let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
291
+ let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
292
+
293
+ create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 10_000_000 , 1_000_000_000 ) ;
294
+
295
+ let alice = & nodes[ 0 ] ;
296
+ let alice_id = alice. node . get_our_node_id ( ) ;
297
+
298
+ let absolute_expiry = Duration :: from_secs ( u64:: MAX ) ;
299
+ let payment_id = PaymentId ( [ 1 ; 32 ] ) ;
300
+
301
+ let refund = alice. node
302
+ . create_refund_builder ( 10_000_000 , absolute_expiry, payment_id, Retry :: Attempts ( 0 ) , None , None )
303
+ . unwrap ( )
304
+ . build ( ) . unwrap ( ) ;
305
+ assert_eq ! ( refund. amount_msats( ) , 10_000_000 ) ;
306
+ assert_eq ! ( refund. absolute_expiry( ) , Some ( absolute_expiry) ) ;
307
+ assert_eq ! ( refund. payer_signing_pubkey( ) , alice_id) ;
308
+ assert ! ( refund. paths( ) . is_empty( ) ) ;
309
+ }
310
+
264
311
/// Checks that blinded paths without Tor-only nodes are preferred when constructing an offer.
265
312
#[ test]
266
313
fn prefers_non_tor_nodes_in_blinded_paths ( ) {
0 commit comments