@@ -142,8 +142,8 @@ impl OfferBuilder {
142
142
}
143
143
144
144
///
145
- pub fn send_invoice ( mut self , send_invoice : SendInvoice ) -> Self {
146
- self . offer . send_invoice = Some ( send_invoice ) ;
145
+ pub fn send_invoice ( mut self ) -> Self {
146
+ self . offer . send_invoice = Some ( SendInvoice ) ;
147
147
self
148
148
}
149
149
@@ -308,11 +308,6 @@ impl Offer {
308
308
) ,
309
309
} ;
310
310
311
- let ( send_invoice, refund_for) = match & self . send_invoice {
312
- None => ( None , None ) ,
313
- Some ( SendInvoice { refund_for } ) => ( Some ( & ( ) ) , refund_for. as_ref ( ) ) ,
314
- } ;
315
-
316
311
reference:: OfferTlvStream {
317
312
chains : self . chains . as_ref ( ) . map ( Into :: into) ,
318
313
currency,
@@ -325,8 +320,7 @@ impl Offer {
325
320
quantity_min : self . quantity_min . map ( Into :: into) ,
326
321
quantity_max : self . quantity_max . map ( Into :: into) ,
327
322
node_id : self . node_id . as_ref ( ) ,
328
- send_invoice,
329
- refund_for,
323
+ send_invoice : self . send_invoice . as_ref ( ) . map ( |_| & ( ) ) ,
330
324
signature : self . signature . as_ref ( ) ,
331
325
}
332
326
}
@@ -369,7 +363,6 @@ tlv_stream!(struct OfferTlvStream {
369
363
( 22 , quantity_min: u64 ) ,
370
364
( 24 , quantity_max: u64 ) ,
371
365
( 30 , node_id: PublicKey ) ,
372
- ( 34 , refund_for: PaymentHash ) ,
373
366
( 54 , send_invoice: Empty ) ,
374
367
( 240 , signature: Signature ) ,
375
368
} ) ;
@@ -401,7 +394,6 @@ mod tests {
401
394
use bitcoin:: secp256k1:: { KeyPair , PublicKey , Secp256k1 , SecretKey } ;
402
395
use core:: num:: NonZeroU64 ;
403
396
use core:: time:: Duration ;
404
- use ln:: PaymentHash ;
405
397
use ln:: features:: OfferFeatures ;
406
398
407
399
fn pubkey ( ) -> PublicKey {
@@ -453,7 +445,6 @@ mod tests {
453
445
assert_eq ! ( tlv_stream. quantity_min, None ) ;
454
446
assert_eq ! ( tlv_stream. quantity_max, None ) ;
455
447
assert_eq ! ( tlv_stream. node_id, Some ( & pubkey( ) ) ) ;
456
- assert_eq ! ( tlv_stream. refund_for, None ) ;
457
448
assert_eq ! ( tlv_stream. send_invoice, None ) ;
458
449
assert_eq ! ( tlv_stream. signature, None ) ;
459
450
}
@@ -766,31 +757,11 @@ mod tests {
766
757
767
758
#[ test]
768
759
fn builds_offer_with_send_invoice ( ) {
769
- let refund_for = Some ( PaymentHash ( [ 0 ; 32 ] ) ) ;
770
-
771
- let offer = OfferBuilder :: new ( "foo" . into ( ) , Destination :: NodeId ( pubkey ( ) ) )
772
- . send_invoice ( SendInvoice { refund_for : None } )
773
- . build ( ) ;
774
- let tlv_stream = offer. as_tlv_stream ( ) ;
775
- assert_eq ! ( offer. send_invoice( ) , Some ( & SendInvoice { refund_for: None } ) ) ;
776
- assert_eq ! ( tlv_stream. refund_for, None ) ;
777
- assert_eq ! ( tlv_stream. send_invoice, Some ( & ( ) ) ) ;
778
-
779
- let offer = OfferBuilder :: new ( "foo" . into ( ) , Destination :: NodeId ( pubkey ( ) ) )
780
- . send_invoice ( SendInvoice { refund_for } )
781
- . build ( ) ;
782
- let tlv_stream = offer. as_tlv_stream ( ) ;
783
- assert_eq ! ( offer. send_invoice( ) , Some ( & SendInvoice { refund_for } ) ) ;
784
- assert_eq ! ( tlv_stream. refund_for, refund_for. as_ref( ) ) ;
785
- assert_eq ! ( tlv_stream. send_invoice, Some ( & ( ) ) ) ;
786
-
787
760
let offer = OfferBuilder :: new ( "foo" . into ( ) , Destination :: NodeId ( pubkey ( ) ) )
788
- . send_invoice ( SendInvoice { refund_for } )
789
- . send_invoice ( SendInvoice { refund_for : None } )
761
+ . send_invoice ( )
790
762
. build ( ) ;
791
763
let tlv_stream = offer. as_tlv_stream ( ) ;
792
- assert_eq ! ( offer. send_invoice( ) , Some ( & SendInvoice { refund_for: None } ) ) ;
793
- assert_eq ! ( tlv_stream. refund_for, None ) ;
764
+ assert_eq ! ( offer. send_invoice( ) , Some ( & SendInvoice ) ) ;
794
765
assert_eq ! ( tlv_stream. send_invoice, Some ( & ( ) ) ) ;
795
766
}
796
767
}
0 commit comments