@@ -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
@@ -664,6 +672,8 @@ pub(super) struct InvoiceRequestContentsWithoutPayerSigningPubkey {
664
672
features : InvoiceRequestFeatures ,
665
673
quantity : Option < u64 > ,
666
674
payer_note : Option < String > ,
675
+ #[ cfg( test) ]
676
+ experimental_bar : Option < u64 > ,
667
677
}
668
678
669
679
macro_rules! invoice_request_accessors { ( $self: ident, $contents: expr) => {
@@ -962,7 +972,9 @@ impl VerifiedInvoiceRequest {
962
972
let InvoiceRequestContents {
963
973
payer_signing_pubkey,
964
974
inner : InvoiceRequestContentsWithoutPayerSigningPubkey {
965
- payer : _, offer : _, chain : _, amount_msats : _, features : _, quantity, payer_note
975
+ payer : _, offer : _, chain : _, amount_msats : _, features : _, quantity, payer_note,
976
+ #[ cfg( test) ]
977
+ experimental_bar : _,
966
978
} ,
967
979
} = & self . inner . contents ;
968
980
@@ -1044,7 +1056,10 @@ impl InvoiceRequestContentsWithoutPayerSigningPubkey {
1044
1056
paths : None ,
1045
1057
} ;
1046
1058
1047
- let experimental_invoice_request = ExperimentalInvoiceRequestTlvStreamRef { } ;
1059
+ let experimental_invoice_request = ExperimentalInvoiceRequestTlvStreamRef {
1060
+ #[ cfg( test) ]
1061
+ experimental_bar : self . experimental_bar ,
1062
+ } ;
1048
1063
1049
1064
( payer, offer, invoice_request, experimental_offer, experimental_invoice_request)
1050
1065
}
@@ -1094,11 +1109,20 @@ tlv_stream!(InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef<'a>, INVOICE_REQ
1094
1109
pub ( super ) const EXPERIMENTAL_INVOICE_REQUEST_TYPES : core:: ops:: Range < u64 > =
1095
1110
2_000_000_000 ..3_000_000_000 ;
1096
1111
1112
+ #[ cfg( not( test) ) ]
1097
1113
tlv_stream ! (
1098
1114
ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef ,
1099
1115
EXPERIMENTAL_INVOICE_REQUEST_TYPES , { }
1100
1116
) ;
1101
1117
1118
+ #[ cfg( test) ]
1119
+ tlv_stream ! (
1120
+ ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef ,
1121
+ EXPERIMENTAL_INVOICE_REQUEST_TYPES , {
1122
+ ( 2_999_999_999 , experimental_bar: ( u64 , HighZeroBytesDroppedBigSize ) ) ,
1123
+ }
1124
+ ) ;
1125
+
1102
1126
type FullInvoiceRequestTlvStream = (
1103
1127
PayerTlvStream , OfferTlvStream , InvoiceRequestTlvStream , SignatureTlvStream ,
1104
1128
ExperimentalOfferTlvStream , ExperimentalInvoiceRequestTlvStream ,
@@ -1206,7 +1230,10 @@ impl TryFrom<PartialInvoiceRequestTlvStream> for InvoiceRequestContents {
1206
1230
chain, amount, features, quantity, payer_id, payer_note, paths,
1207
1231
} ,
1208
1232
experimental_offer_tlv_stream,
1209
- ExperimentalInvoiceRequestTlvStream { } ,
1233
+ ExperimentalInvoiceRequestTlvStream {
1234
+ #[ cfg( test) ]
1235
+ experimental_bar,
1236
+ } ,
1210
1237
) = tlv_stream;
1211
1238
1212
1239
let payer = match metadata {
@@ -1240,6 +1267,8 @@ impl TryFrom<PartialInvoiceRequestTlvStream> for InvoiceRequestContents {
1240
1267
Ok ( InvoiceRequestContents {
1241
1268
inner : InvoiceRequestContentsWithoutPayerSigningPubkey {
1242
1269
payer, offer, chain, amount_msats : amount, features, quantity, payer_note,
1270
+ #[ cfg( test) ]
1271
+ experimental_bar,
1243
1272
} ,
1244
1273
payer_signing_pubkey,
1245
1274
} )
@@ -1422,7 +1451,9 @@ mod tests {
1422
1451
ExperimentalOfferTlvStreamRef {
1423
1452
experimental_foo: None ,
1424
1453
} ,
1425
- ExperimentalInvoiceRequestTlvStreamRef { } ,
1454
+ ExperimentalInvoiceRequestTlvStreamRef {
1455
+ experimental_bar: None ,
1456
+ } ,
1426
1457
) ,
1427
1458
) ;
1428
1459
@@ -1475,6 +1506,7 @@ mod tests {
1475
1506
let invoice_request = offer
1476
1507
. request_invoice_deriving_metadata ( signing_pubkey, & expanded_key, nonce, payment_id)
1477
1508
. unwrap ( )
1509
+ . experimental_bar ( 42 )
1478
1510
. build ( ) . unwrap ( )
1479
1511
. sign ( payer_sign) . unwrap ( ) ;
1480
1512
assert_eq ! ( invoice_request. payer_signing_pubkey( ) , payer_pubkey( ) ) ;
@@ -1565,6 +1597,7 @@ mod tests {
1565
1597
let invoice_request = offer
1566
1598
. request_invoice_deriving_signing_pubkey ( & expanded_key, nonce, & secp_ctx, payment_id)
1567
1599
. unwrap ( )
1600
+ . experimental_bar ( 42 )
1568
1601
. build_and_sign ( )
1569
1602
. unwrap ( ) ;
1570
1603
0 commit comments