@@ -241,6 +241,8 @@ macro_rules! invoice_request_builder_methods { (
241
241
InvoiceRequestContentsWithoutPayerSigningPubkey {
242
242
payer: PayerContents ( metadata) , offer, chain: None , amount_msats: None ,
243
243
features: InvoiceRequestFeatures :: empty( ) , quantity: None , payer_note: None ,
244
+ #[ cfg( test) ]
245
+ experimental_bar: None ,
244
246
}
245
247
}
246
248
@@ -404,6 +406,12 @@ macro_rules! invoice_request_builder_test_methods { (
404
406
$return_value
405
407
}
406
408
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
+
407
415
#[ cfg_attr( c_bindings, allow( dead_code) ) ]
408
416
pub ( super ) fn build_unchecked( $self: $self_type) -> UnsignedInvoiceRequest {
409
417
$self. build_without_checks( ) . 0
@@ -691,6 +699,8 @@ pub(super) struct InvoiceRequestContentsWithoutPayerSigningPubkey {
691
699
features : InvoiceRequestFeatures ,
692
700
quantity : Option < u64 > ,
693
701
payer_note : Option < String > ,
702
+ #[ cfg( test) ]
703
+ experimental_bar : Option < u64 > ,
694
704
}
695
705
696
706
macro_rules! invoice_request_accessors { ( $self: ident, $contents: expr) => {
@@ -994,7 +1004,9 @@ impl VerifiedInvoiceRequest {
994
1004
let InvoiceRequestContents {
995
1005
payer_signing_pubkey,
996
1006
inner : InvoiceRequestContentsWithoutPayerSigningPubkey {
997
- payer : _, offer : _, chain : _, amount_msats : _, features : _, quantity, payer_note
1007
+ payer : _, offer : _, chain : _, amount_msats : _, features : _, quantity, payer_note,
1008
+ #[ cfg( test) ]
1009
+ experimental_bar : _,
998
1010
} ,
999
1011
} = & self . inner . contents ;
1000
1012
@@ -1076,7 +1088,10 @@ impl InvoiceRequestContentsWithoutPayerSigningPubkey {
1076
1088
paths : None ,
1077
1089
} ;
1078
1090
1079
- let experimental_invoice_request = ExperimentalInvoiceRequestTlvStreamRef { } ;
1091
+ let experimental_invoice_request = ExperimentalInvoiceRequestTlvStreamRef {
1092
+ #[ cfg( test) ]
1093
+ experimental_bar : self . experimental_bar ,
1094
+ } ;
1080
1095
1081
1096
( payer, offer, invoice_request, experimental_offer, experimental_invoice_request)
1082
1097
}
@@ -1133,11 +1148,20 @@ tlv_stream!(InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef<'a>, INVOICE_REQ
1133
1148
pub ( super ) const EXPERIMENTAL_INVOICE_REQUEST_TYPES : core:: ops:: Range < u64 > =
1134
1149
2_000_000_000 ..3_000_000_000 ;
1135
1150
1151
+ #[ cfg( not( test) ) ]
1136
1152
tlv_stream ! (
1137
1153
ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef ,
1138
1154
EXPERIMENTAL_INVOICE_REQUEST_TYPES , { }
1139
1155
) ;
1140
1156
1157
+ #[ cfg( test) ]
1158
+ tlv_stream ! (
1159
+ ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef ,
1160
+ EXPERIMENTAL_INVOICE_REQUEST_TYPES , {
1161
+ ( 2_999_999_999 , experimental_bar: ( u64 , HighZeroBytesDroppedBigSize ) ) ,
1162
+ }
1163
+ ) ;
1164
+
1141
1165
type FullInvoiceRequestTlvStream = (
1142
1166
PayerTlvStream , OfferTlvStream , InvoiceRequestTlvStream , SignatureTlvStream ,
1143
1167
ExperimentalOfferTlvStream , ExperimentalInvoiceRequestTlvStream ,
@@ -1244,7 +1268,10 @@ impl TryFrom<PartialInvoiceRequestTlvStream> for InvoiceRequestContents {
1244
1268
chain, amount, features, quantity, payer_id, payer_note, paths,
1245
1269
} ,
1246
1270
experimental_offer_tlv_stream,
1247
- ExperimentalInvoiceRequestTlvStream { } ,
1271
+ ExperimentalInvoiceRequestTlvStream {
1272
+ #[ cfg( test) ]
1273
+ experimental_bar,
1274
+ } ,
1248
1275
) = tlv_stream;
1249
1276
1250
1277
let payer = match metadata {
@@ -1278,6 +1305,8 @@ impl TryFrom<PartialInvoiceRequestTlvStream> for InvoiceRequestContents {
1278
1305
Ok ( InvoiceRequestContents {
1279
1306
inner : InvoiceRequestContentsWithoutPayerSigningPubkey {
1280
1307
payer, offer, chain, amount_msats : amount, features, quantity, payer_note,
1308
+ #[ cfg( test) ]
1309
+ experimental_bar,
1281
1310
} ,
1282
1311
payer_signing_pubkey,
1283
1312
} )
@@ -1460,7 +1489,9 @@ mod tests {
1460
1489
ExperimentalOfferTlvStreamRef {
1461
1490
experimental_foo: None ,
1462
1491
} ,
1463
- ExperimentalInvoiceRequestTlvStreamRef { } ,
1492
+ ExperimentalInvoiceRequestTlvStreamRef {
1493
+ experimental_bar: None ,
1494
+ } ,
1464
1495
) ,
1465
1496
) ;
1466
1497
@@ -1513,6 +1544,7 @@ mod tests {
1513
1544
let invoice_request = offer
1514
1545
. request_invoice_deriving_metadata ( signing_pubkey, & expanded_key, nonce, payment_id)
1515
1546
. unwrap ( )
1547
+ . experimental_bar ( 42 )
1516
1548
. build ( ) . unwrap ( )
1517
1549
. sign ( payer_sign) . unwrap ( ) ;
1518
1550
assert_eq ! ( invoice_request. payer_signing_pubkey( ) , payer_pubkey( ) ) ;
@@ -1603,6 +1635,7 @@ mod tests {
1603
1635
let invoice_request = offer
1604
1636
. request_invoice_deriving_signing_pubkey ( & expanded_key, nonce, & secp_ctx, payment_id)
1605
1637
. unwrap ( )
1638
+ . experimental_bar ( 42 )
1606
1639
. build_and_sign ( )
1607
1640
. unwrap ( ) ;
1608
1641
0 commit comments