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