@@ -424,10 +424,13 @@ fn simple_bolt12_send_receive() {
424
424
std:: thread:: sleep ( std:: time:: Duration :: from_secs ( 1 ) ) ;
425
425
426
426
let expected_amount_msat = 100_000_000 ;
427
- let offer = node_b. bolt12_payment ( ) . receive ( expected_amount_msat, "asdf" ) . unwrap ( ) ;
428
- let quantity = Some ( 1 ) ;
429
- let payer_note = Some ( "Test" . to_string ( ) ) ;
430
- let payment_id = node_a. bolt12_payment ( ) . send ( & offer, quantity, payer_note. clone ( ) ) . unwrap ( ) ;
427
+ let offer = node_b. bolt12_payment ( ) . receive ( expected_amount_msat, "asdf" , None ) . unwrap ( ) ;
428
+ let expected_quantity = Some ( 1 ) ;
429
+ let expected_payer_note = Some ( "Test" . to_string ( ) ) ;
430
+ let payment_id = node_a
431
+ . bolt12_payment ( )
432
+ . send ( & offer, expected_quantity, expected_payer_note. clone ( ) )
433
+ . unwrap ( ) ;
431
434
432
435
expect_payment_successful_event ! ( node_a, Some ( payment_id) , None ) ;
433
436
let node_a_payments = node_a. list_payments ( ) ;
@@ -444,8 +447,8 @@ fn simple_bolt12_send_receive() {
444
447
assert ! ( hash. is_some( ) ) ;
445
448
assert ! ( preimage. is_some( ) ) ;
446
449
assert_eq ! ( offer_id, offer. id( ) ) ;
447
- assert_eq ! ( & quantity , qty) ;
448
- assert_eq ! ( payer_note . unwrap( ) , note. clone( ) . unwrap( ) . 0 ) ;
450
+ assert_eq ! ( & expected_quantity , qty) ;
451
+ assert_eq ! ( expected_payer_note . unwrap( ) , note. clone( ) . unwrap( ) . 0 ) ;
449
452
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
450
453
//API currently doesn't allow to do that.
451
454
} ,
@@ -475,16 +478,21 @@ fn simple_bolt12_send_receive() {
475
478
let offer_amount_msat = 100_000_000 ;
476
479
let less_than_offer_amount = offer_amount_msat - 10_000 ;
477
480
let expected_amount_msat = offer_amount_msat + 10_000 ;
478
- let offer = node_b. bolt12_payment ( ) . receive ( offer_amount_msat, "asdf" ) . unwrap ( ) ;
479
- let quantity = Some ( 1 ) ;
480
- let payer_note = Some ( "Test" . to_string ( ) ) ;
481
+ let offer = node_b. bolt12_payment ( ) . receive ( offer_amount_msat, "asdf" , None ) . unwrap ( ) ;
482
+ let expected_quantity = Some ( 1 ) ;
483
+ let expected_payer_note = Some ( "Test" . to_string ( ) ) ;
481
484
assert ! ( node_a
482
485
. bolt12_payment( )
483
486
. send_using_amount( & offer, less_than_offer_amount, None , None )
484
487
. is_err( ) ) ;
485
488
let payment_id = node_a
486
489
. bolt12_payment ( )
487
- . send_using_amount ( & offer, expected_amount_msat, quantity, payer_note. clone ( ) )
490
+ . send_using_amount (
491
+ & offer,
492
+ expected_amount_msat,
493
+ expected_quantity,
494
+ expected_payer_note. clone ( ) ,
495
+ )
488
496
. unwrap ( ) ;
489
497
490
498
expect_payment_successful_event ! ( node_a, Some ( payment_id) , None ) ;
@@ -502,8 +510,8 @@ fn simple_bolt12_send_receive() {
502
510
assert ! ( hash. is_some( ) ) ;
503
511
assert ! ( preimage. is_some( ) ) ;
504
512
assert_eq ! ( offer_id, offer. id( ) ) ;
505
- assert_eq ! ( & quantity , qty) ;
506
- assert_eq ! ( payer_note . unwrap( ) , note. clone( ) . unwrap( ) . 0 ) ;
513
+ assert_eq ! ( & expected_quantity , qty) ;
514
+ assert_eq ! ( expected_payer_note . unwrap( ) , note. clone( ) . unwrap( ) . 0 ) ;
507
515
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
508
516
//API currently doesn't allow to do that.
509
517
hash. unwrap ( )
@@ -533,11 +541,11 @@ fn simple_bolt12_send_receive() {
533
541
534
542
// Now node_b refunds the amount node_a just overpaid.
535
543
let overpaid_amount = expected_amount_msat - offer_amount_msat;
536
- let quantity = Some ( 1 ) ;
537
- let payer_note = Some ( "Test" . to_string ( ) ) ;
544
+ let expected_quantity = Some ( 1 ) ;
545
+ let expected_payer_note = Some ( "Test" . to_string ( ) ) ;
538
546
let refund = node_b
539
547
. bolt12_payment ( )
540
- . initiate_refund ( overpaid_amount, 3600 , quantity , payer_note . clone ( ) )
548
+ . initiate_refund ( overpaid_amount, 3600 , expected_quantity , expected_payer_note . clone ( ) )
541
549
. unwrap ( ) ;
542
550
let invoice = node_a. bolt12_payment ( ) . request_refund_payment ( & refund) . unwrap ( ) ;
543
551
expect_payment_received_event ! ( node_a, overpaid_amount) ;
@@ -561,8 +569,8 @@ fn simple_bolt12_send_receive() {
561
569
} => {
562
570
assert ! ( hash. is_some( ) ) ;
563
571
assert ! ( preimage. is_some( ) ) ;
564
- assert_eq ! ( & quantity , qty) ;
565
- assert_eq ! ( payer_note . unwrap( ) , note. clone( ) . unwrap( ) . 0 )
572
+ assert_eq ! ( & expected_quantity , qty) ;
573
+ assert_eq ! ( expected_payer_note . unwrap( ) , note. clone( ) . unwrap( ) . 0 )
566
574
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
567
575
//API currently doesn't allow to do that.
568
576
} ,
0 commit comments