@@ -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) => {
@@ -967,7 +977,9 @@ impl VerifiedInvoiceRequest {
967
977
let InvoiceRequestContents {
968
978
payer_signing_pubkey,
969
979
inner : InvoiceRequestContentsWithoutPayerSigningPubkey {
970
- payer : _, offer : _, chain : _, amount_msats : _, features : _, quantity, payer_note
980
+ payer : _, offer : _, chain : _, amount_msats : _, features : _, quantity, payer_note,
981
+ #[ cfg( test) ]
982
+ experimental_bar : _,
971
983
} ,
972
984
} = & self . inner . contents ;
973
985
@@ -1049,7 +1061,10 @@ impl InvoiceRequestContentsWithoutPayerSigningPubkey {
1049
1061
paths : None ,
1050
1062
} ;
1051
1063
1052
- let experimental_invoice_request = ExperimentalInvoiceRequestTlvStreamRef { } ;
1064
+ let experimental_invoice_request = ExperimentalInvoiceRequestTlvStreamRef {
1065
+ #[ cfg( test) ]
1066
+ experimental_bar : self . experimental_bar ,
1067
+ } ;
1053
1068
1054
1069
( payer, offer, invoice_request, experimental_offer, experimental_invoice_request)
1055
1070
}
@@ -1106,11 +1121,20 @@ tlv_stream!(InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef<'a>, INVOICE_REQ
1106
1121
pub ( super ) const EXPERIMENTAL_INVOICE_REQUEST_TYPES : core:: ops:: Range < u64 > =
1107
1122
2_000_000_000 ..3_000_000_000 ;
1108
1123
1124
+ #[ cfg( not( test) ) ]
1109
1125
tlv_stream ! (
1110
1126
ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef ,
1111
1127
EXPERIMENTAL_INVOICE_REQUEST_TYPES , { }
1112
1128
) ;
1113
1129
1130
+ #[ cfg( test) ]
1131
+ tlv_stream ! (
1132
+ ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef ,
1133
+ EXPERIMENTAL_INVOICE_REQUEST_TYPES , {
1134
+ ( 2_999_999_999 , experimental_bar: ( u64 , HighZeroBytesDroppedBigSize ) ) ,
1135
+ }
1136
+ ) ;
1137
+
1114
1138
type FullInvoiceRequestTlvStream = (
1115
1139
PayerTlvStream , OfferTlvStream , InvoiceRequestTlvStream , SignatureTlvStream ,
1116
1140
ExperimentalOfferTlvStream , ExperimentalInvoiceRequestTlvStream ,
@@ -1218,7 +1242,10 @@ impl TryFrom<PartialInvoiceRequestTlvStream> for InvoiceRequestContents {
1218
1242
chain, amount, features, quantity, payer_id, payer_note, paths,
1219
1243
} ,
1220
1244
experimental_offer_tlv_stream,
1221
- ExperimentalInvoiceRequestTlvStream { } ,
1245
+ ExperimentalInvoiceRequestTlvStream {
1246
+ #[ cfg( test) ]
1247
+ experimental_bar,
1248
+ } ,
1222
1249
) = tlv_stream;
1223
1250
1224
1251
let payer = match metadata {
@@ -1252,6 +1279,8 @@ impl TryFrom<PartialInvoiceRequestTlvStream> for InvoiceRequestContents {
1252
1279
Ok ( InvoiceRequestContents {
1253
1280
inner : InvoiceRequestContentsWithoutPayerSigningPubkey {
1254
1281
payer, offer, chain, amount_msats : amount, features, quantity, payer_note,
1282
+ #[ cfg( test) ]
1283
+ experimental_bar,
1255
1284
} ,
1256
1285
payer_signing_pubkey,
1257
1286
} )
@@ -1434,7 +1463,9 @@ mod tests {
1434
1463
ExperimentalOfferTlvStreamRef {
1435
1464
experimental_foo: None ,
1436
1465
} ,
1437
- ExperimentalInvoiceRequestTlvStreamRef { } ,
1466
+ ExperimentalInvoiceRequestTlvStreamRef {
1467
+ experimental_bar: None ,
1468
+ } ,
1438
1469
) ,
1439
1470
) ;
1440
1471
@@ -1487,6 +1518,7 @@ mod tests {
1487
1518
let invoice_request = offer
1488
1519
. request_invoice_deriving_metadata ( signing_pubkey, & expanded_key, nonce, payment_id)
1489
1520
. unwrap ( )
1521
+ . experimental_bar ( 42 )
1490
1522
. build ( ) . unwrap ( )
1491
1523
. sign ( payer_sign) . unwrap ( ) ;
1492
1524
assert_eq ! ( invoice_request. payer_signing_pubkey( ) , payer_pubkey( ) ) ;
@@ -1577,6 +1609,7 @@ mod tests {
1577
1609
let invoice_request = offer
1578
1610
. request_invoice_deriving_signing_pubkey ( & expanded_key, nonce, & secp_ctx, payment_id)
1579
1611
. unwrap ( )
1612
+ . experimental_bar ( 42 )
1580
1613
. build_and_sign ( )
1581
1614
. unwrap ( ) ;
1582
1615
0 commit comments