@@ -141,8 +141,8 @@ impl OfferBuilder {
141
141
}
142
142
143
143
///
144
- pub fn send_invoice ( mut self , send_invoice : SendInvoice ) -> Self {
145
- self . offer . send_invoice = Some ( send_invoice ) ;
144
+ pub fn send_invoice ( mut self ) -> Self {
145
+ self . offer . send_invoice = Some ( SendInvoice ) ;
146
146
self
147
147
}
148
148
@@ -296,11 +296,6 @@ impl Offer {
296
296
) ,
297
297
} ;
298
298
299
- let ( send_invoice, refund_for) = match & self . send_invoice {
300
- None => ( None , None ) ,
301
- Some ( SendInvoice { refund_for } ) => ( Some ( & ( ) ) , refund_for. as_ref ( ) ) ,
302
- } ;
303
-
304
299
reference:: OfferTlvStream {
305
300
chains : self . chains . as_ref ( ) . map ( Into :: into) ,
306
301
currency,
@@ -313,8 +308,7 @@ impl Offer {
313
308
quantity_min : self . quantity_min . map ( Into :: into) ,
314
309
quantity_max : self . quantity_max . map ( Into :: into) ,
315
310
node_id : self . node_id . as_ref ( ) ,
316
- send_invoice,
317
- refund_for,
311
+ send_invoice : self . send_invoice . as_ref ( ) . map ( |_| & ( ) ) ,
318
312
signature : self . signature . as_ref ( ) ,
319
313
}
320
314
}
@@ -357,7 +351,6 @@ tlv_stream!(struct OfferTlvStream {
357
351
( 22 , quantity_min: u64 ) ,
358
352
( 24 , quantity_max: u64 ) ,
359
353
( 30 , node_id: PublicKey ) ,
360
- ( 34 , refund_for: PaymentHash ) ,
361
354
( 54 , send_invoice: Empty ) ,
362
355
( 240 , signature: Signature ) ,
363
356
} ) ;
@@ -389,7 +382,6 @@ mod tests {
389
382
use bitcoin:: secp256k1:: { KeyPair , PublicKey , Secp256k1 , SecretKey } ;
390
383
use core:: num:: NonZeroU64 ;
391
384
use core:: time:: Duration ;
392
- use ln:: PaymentHash ;
393
385
use ln:: features:: OfferFeatures ;
394
386
395
387
fn pubkey ( ) -> PublicKey {
@@ -441,7 +433,6 @@ mod tests {
441
433
assert_eq ! ( tlv_stream. quantity_min, None ) ;
442
434
assert_eq ! ( tlv_stream. quantity_max, None ) ;
443
435
assert_eq ! ( tlv_stream. node_id, Some ( & pubkey( ) ) ) ;
444
- assert_eq ! ( tlv_stream. refund_for, None ) ;
445
436
assert_eq ! ( tlv_stream. send_invoice, None ) ;
446
437
assert_eq ! ( tlv_stream. signature, None ) ;
447
438
}
@@ -754,31 +745,11 @@ mod tests {
754
745
755
746
#[ test]
756
747
fn builds_offer_with_send_invoice ( ) {
757
- let refund_for = Some ( PaymentHash ( [ 0 ; 32 ] ) ) ;
758
-
759
- let offer = OfferBuilder :: new ( "foo" . into ( ) , Destination :: NodeId ( pubkey ( ) ) )
760
- . send_invoice ( SendInvoice { refund_for : None } )
761
- . build ( ) ;
762
- let tlv_stream = offer. as_tlv_stream ( ) ;
763
- assert_eq ! ( offer. send_invoice( ) , Some ( & SendInvoice { refund_for: None } ) ) ;
764
- assert_eq ! ( tlv_stream. refund_for, None ) ;
765
- assert_eq ! ( tlv_stream. send_invoice, Some ( & ( ) ) ) ;
766
-
767
- let offer = OfferBuilder :: new ( "foo" . into ( ) , Destination :: NodeId ( pubkey ( ) ) )
768
- . send_invoice ( SendInvoice { refund_for } )
769
- . build ( ) ;
770
- let tlv_stream = offer. as_tlv_stream ( ) ;
771
- assert_eq ! ( offer. send_invoice( ) , Some ( & SendInvoice { refund_for } ) ) ;
772
- assert_eq ! ( tlv_stream. refund_for, refund_for. as_ref( ) ) ;
773
- assert_eq ! ( tlv_stream. send_invoice, Some ( & ( ) ) ) ;
774
-
775
748
let offer = OfferBuilder :: new ( "foo" . into ( ) , Destination :: NodeId ( pubkey ( ) ) )
776
- . send_invoice ( SendInvoice { refund_for } )
777
- . send_invoice ( SendInvoice { refund_for : None } )
749
+ . send_invoice ( )
778
750
. build ( ) ;
779
751
let tlv_stream = offer. as_tlv_stream ( ) ;
780
- assert_eq ! ( offer. send_invoice( ) , Some ( & SendInvoice { refund_for: None } ) ) ;
781
- assert_eq ! ( tlv_stream. refund_for, None ) ;
752
+ assert_eq ! ( offer. send_invoice( ) , Some ( & SendInvoice ) ) ;
782
753
assert_eq ! ( tlv_stream. send_invoice, Some ( & ( ) ) ) ;
783
754
}
784
755
}
0 commit comments