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