@@ -241,6 +241,8 @@ macro_rules! invoice_request_builder_methods { (
241241 InvoiceRequestContentsWithoutPayerSigningPubkey {
242242 payer: PayerContents ( metadata) , offer, chain: None , amount_msats: None ,
243243 features: InvoiceRequestFeatures :: empty( ) , quantity: None , payer_note: None ,
244+ #[ cfg( test) ]
245+ experimental_bar: None ,
244246 }
245247 }
246248
@@ -404,6 +406,12 @@ macro_rules! invoice_request_builder_test_methods { (
404406 $return_value
405407 }
406408
409+ #[ cfg_attr( c_bindings, allow( dead_code) ) ]
410+ pub ( super ) fn experimental_bar( $( $self_mut) * $self: $self_type, experimental_bar: u64 ) -> $return_type {
411+ $self. invoice_request. experimental_bar = Some ( experimental_bar) ;
412+ $return_value
413+ }
414+
407415 #[ cfg_attr( c_bindings, allow( dead_code) ) ]
408416 pub ( super ) fn build_unchecked( $self: $self_type) -> UnsignedInvoiceRequest {
409417 $self. build_without_checks( ) . 0
@@ -684,6 +692,8 @@ pub(super) struct InvoiceRequestContentsWithoutPayerSigningPubkey {
684692 features : InvoiceRequestFeatures ,
685693 quantity : Option < u64 > ,
686694 payer_note : Option < String > ,
695+ #[ cfg( test) ]
696+ experimental_bar : Option < u64 > ,
687697}
688698
689699macro_rules! invoice_request_accessors { ( $self: ident, $contents: expr) => {
@@ -987,7 +997,9 @@ impl VerifiedInvoiceRequest {
987997 let InvoiceRequestContents {
988998 payer_signing_pubkey,
989999 inner : InvoiceRequestContentsWithoutPayerSigningPubkey {
990- payer : _, offer : _, chain : _, amount_msats : _, features : _, quantity, payer_note
1000+ payer : _, offer : _, chain : _, amount_msats : _, features : _, quantity, payer_note,
1001+ #[ cfg( test) ]
1002+ experimental_bar : _,
9911003 } ,
9921004 } = & self . inner . contents ;
9931005
@@ -1069,7 +1081,10 @@ impl InvoiceRequestContentsWithoutPayerSigningPubkey {
10691081 paths : None ,
10701082 } ;
10711083
1072- let experimental_invoice_request = ExperimentalInvoiceRequestTlvStreamRef { } ;
1084+ let experimental_invoice_request = ExperimentalInvoiceRequestTlvStreamRef {
1085+ #[ cfg( test) ]
1086+ experimental_bar : self . experimental_bar ,
1087+ } ;
10731088
10741089 ( payer, offer, invoice_request, experimental_offer, experimental_invoice_request)
10751090 }
@@ -1126,11 +1141,20 @@ tlv_stream!(InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef<'a>, INVOICE_REQ
11261141pub ( super ) const EXPERIMENTAL_INVOICE_REQUEST_TYPES : core:: ops:: Range < u64 > =
11271142 2_000_000_000 ..3_000_000_000 ;
11281143
1144+ #[ cfg( not( test) ) ]
11291145tlv_stream ! (
11301146 ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef ,
11311147 EXPERIMENTAL_INVOICE_REQUEST_TYPES , { }
11321148) ;
11331149
1150+ #[ cfg( test) ]
1151+ tlv_stream ! (
1152+ ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef ,
1153+ EXPERIMENTAL_INVOICE_REQUEST_TYPES , {
1154+ ( 2_999_999_999 , experimental_bar: ( u64 , HighZeroBytesDroppedBigSize ) ) ,
1155+ }
1156+ ) ;
1157+
11341158type FullInvoiceRequestTlvStream = (
11351159 PayerTlvStream , OfferTlvStream , InvoiceRequestTlvStream , SignatureTlvStream ,
11361160 ExperimentalOfferTlvStream , ExperimentalInvoiceRequestTlvStream ,
@@ -1237,7 +1261,10 @@ impl TryFrom<PartialInvoiceRequestTlvStream> for InvoiceRequestContents {
12371261 chain, amount, features, quantity, payer_id, payer_note, paths,
12381262 } ,
12391263 experimental_offer_tlv_stream,
1240- ExperimentalInvoiceRequestTlvStream { } ,
1264+ ExperimentalInvoiceRequestTlvStream {
1265+ #[ cfg( test) ]
1266+ experimental_bar,
1267+ } ,
12411268 ) = tlv_stream;
12421269
12431270 let payer = match metadata {
@@ -1271,6 +1298,8 @@ impl TryFrom<PartialInvoiceRequestTlvStream> for InvoiceRequestContents {
12711298 Ok ( InvoiceRequestContents {
12721299 inner : InvoiceRequestContentsWithoutPayerSigningPubkey {
12731300 payer, offer, chain, amount_msats : amount, features, quantity, payer_note,
1301+ #[ cfg( test) ]
1302+ experimental_bar,
12741303 } ,
12751304 payer_signing_pubkey,
12761305 } )
@@ -1453,7 +1482,9 @@ mod tests {
14531482 ExperimentalOfferTlvStreamRef {
14541483 experimental_foo: None ,
14551484 } ,
1456- ExperimentalInvoiceRequestTlvStreamRef { } ,
1485+ ExperimentalInvoiceRequestTlvStreamRef {
1486+ experimental_bar: None ,
1487+ } ,
14571488 ) ,
14581489 ) ;
14591490
@@ -1506,6 +1537,7 @@ mod tests {
15061537 let invoice_request = offer
15071538 . request_invoice_deriving_metadata ( signing_pubkey, & expanded_key, nonce, payment_id)
15081539 . unwrap ( )
1540+ . experimental_bar ( 42 )
15091541 . build ( ) . unwrap ( )
15101542 . sign ( payer_sign) . unwrap ( ) ;
15111543 assert_eq ! ( invoice_request. payer_signing_pubkey( ) , payer_pubkey( ) ) ;
@@ -1596,6 +1628,7 @@ mod tests {
15961628 let invoice_request = offer
15971629 . request_invoice_deriving_signing_pubkey ( & expanded_key, nonce, & secp_ctx, payment_id)
15981630 . unwrap ( )
1631+ . experimental_bar ( 42 )
15991632 . build_and_sign ( )
16001633 . unwrap ( ) ;
16011634
0 commit comments