@@ -225,6 +225,8 @@ macro_rules! offer_explicit_metadata_builder_methods { (
225225 chains: None , metadata: None , amount: None , description: None ,
226226 features: OfferFeatures :: empty( ) , absolute_expiry: None , issuer: None , paths: None ,
227227 supported_quantity: Quantity :: One , issuer_signing_pubkey: Some ( signing_pubkey) ,
228+ #[ cfg( test) ]
229+ experimental_foo: None ,
228230 } ,
229231 metadata_strategy: core:: marker:: PhantomData ,
230232 secp_ctx: None ,
@@ -266,6 +268,8 @@ macro_rules! offer_derived_metadata_builder_methods { ($secp_context: ty) => {
266268 chains: None , metadata: Some ( metadata) , amount: None , description: None ,
267269 features: OfferFeatures :: empty( ) , absolute_expiry: None , issuer: None , paths: None ,
268270 supported_quantity: Quantity :: One , issuer_signing_pubkey: Some ( node_id) ,
271+ #[ cfg( test) ]
272+ experimental_foo: None ,
269273 } ,
270274 metadata_strategy: core:: marker:: PhantomData ,
271275 secp_ctx: Some ( secp_ctx) ,
@@ -464,6 +468,12 @@ macro_rules! offer_builder_test_methods { (
464468 $return_value
465469 }
466470
471+ #[ cfg_attr( c_bindings, allow( dead_code) ) ]
472+ pub ( super ) fn experimental_foo( $( $self_mut) * $self: $self_type, experimental_foo: u64 ) -> $return_type {
473+ $self. offer. experimental_foo = Some ( experimental_foo) ;
474+ $return_value
475+ }
476+
467477 #[ cfg_attr( c_bindings, allow( dead_code) ) ]
468478 pub ( super ) fn build_unchecked( $self: $self_type) -> Offer {
469479 $self. build_without_checks( )
@@ -571,6 +581,8 @@ pub(super) struct OfferContents {
571581 paths : Option < Vec < BlindedMessagePath > > ,
572582 supported_quantity : Quantity ,
573583 issuer_signing_pubkey : Option < PublicKey > ,
584+ #[ cfg( test) ]
585+ experimental_foo : Option < u64 > ,
574586}
575587
576588macro_rules! offer_accessors { ( $self: ident, $contents: expr) => {
@@ -1010,7 +1022,10 @@ impl OfferContents {
10101022 issuer_id : self . issuer_signing_pubkey . as_ref ( ) ,
10111023 } ;
10121024
1013- let experimental_offer = ExperimentalOfferTlvStreamRef { } ;
1025+ let experimental_offer = ExperimentalOfferTlvStreamRef {
1026+ #[ cfg( test) ]
1027+ experimental_foo : self . experimental_foo ,
1028+ } ;
10141029
10151030 ( offer, experimental_offer)
10161031 }
@@ -1107,9 +1122,15 @@ tlv_stream!(OfferTlvStream, OfferTlvStreamRef<'a>, OFFER_TYPES, {
11071122/// Valid type range for experimental offer TLV records.
11081123pub ( super ) const EXPERIMENTAL_OFFER_TYPES : core:: ops:: Range < u64 > = 1_000_000_000 ..2_000_000_000 ;
11091124
1125+ #[ cfg( not( test) ) ]
11101126tlv_stream ! ( ExperimentalOfferTlvStream , ExperimentalOfferTlvStreamRef , EXPERIMENTAL_OFFER_TYPES , {
11111127} ) ;
11121128
1129+ #[ cfg( test) ]
1130+ tlv_stream ! ( ExperimentalOfferTlvStream , ExperimentalOfferTlvStreamRef , EXPERIMENTAL_OFFER_TYPES , {
1131+ ( 1_999_999_999 , experimental_foo: ( u64 , HighZeroBytesDroppedBigSize ) ) ,
1132+ } ) ;
1133+
11131134type FullOfferTlvStream = ( OfferTlvStream , ExperimentalOfferTlvStream ) ;
11141135
11151136type FullOfferTlvStreamRef < ' a > = ( OfferTlvStreamRef < ' a > , ExperimentalOfferTlvStreamRef ) ;
@@ -1157,7 +1178,10 @@ impl TryFrom<FullOfferTlvStream> for OfferContents {
11571178 chains, metadata, currency, amount, description, features, absolute_expiry, paths,
11581179 issuer, quantity_max, issuer_id,
11591180 } ,
1160- ExperimentalOfferTlvStream { } ,
1181+ ExperimentalOfferTlvStream {
1182+ #[ cfg( test) ]
1183+ experimental_foo,
1184+ } ,
11611185 ) = tlv_stream;
11621186
11631187 let metadata = metadata. map ( |metadata| Metadata :: Bytes ( metadata) ) ;
@@ -1196,6 +1220,8 @@ impl TryFrom<FullOfferTlvStream> for OfferContents {
11961220 Ok ( OfferContents {
11971221 chains, metadata, amount, description, features, absolute_expiry, issuer, paths,
11981222 supported_quantity, issuer_signing_pubkey,
1223+ #[ cfg( test) ]
1224+ experimental_foo,
11991225 } )
12001226 }
12011227}
@@ -1274,7 +1300,9 @@ mod tests {
12741300 quantity_max: None ,
12751301 issuer_id: Some ( & pubkey( 42 ) ) ,
12761302 } ,
1277- ExperimentalOfferTlvStreamRef { } ,
1303+ ExperimentalOfferTlvStreamRef {
1304+ experimental_foo: None ,
1305+ } ,
12781306 ) ,
12791307 ) ;
12801308
@@ -1354,6 +1382,7 @@ mod tests {
13541382 use super :: OfferWithDerivedMetadataBuilder as OfferBuilder ;
13551383 let offer = OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce, & secp_ctx)
13561384 . amount_msats ( 1000 )
1385+ . experimental_foo ( 42 )
13571386 . build ( ) . unwrap ( ) ;
13581387 assert ! ( offer. metadata( ) . is_some( ) ) ;
13591388 assert_eq ! ( offer. issuer_signing_pubkey( ) , Some ( node_id) ) ;
@@ -1423,6 +1452,7 @@ mod tests {
14231452 let offer = OfferBuilder :: deriving_signing_pubkey ( node_id, & expanded_key, nonce, & secp_ctx)
14241453 . amount_msats ( 1000 )
14251454 . path ( blinded_path)
1455+ . experimental_foo ( 42 )
14261456 . build ( ) . unwrap ( ) ;
14271457 assert ! ( offer. metadata( ) . is_none( ) ) ;
14281458 assert_ne ! ( offer. issuer_signing_pubkey( ) , Some ( node_id) ) ;
0 commit comments