@@ -120,7 +120,7 @@ use crate::ln::inbound_payment::{ExpandedKey, IV_LEN};
120120use crate :: ln:: msgs:: DecodeError ;
121121use crate :: offers:: invoice_macros:: { invoice_accessors_common, invoice_builder_methods_common} ;
122122#[ cfg( test) ]
123- use crate :: offers:: invoice_macros:: invoice_builder_methods_test ;
123+ use crate :: offers:: invoice_macros:: invoice_builder_methods_test_common ;
124124use crate :: offers:: invoice_request:: { EXPERIMENTAL_INVOICE_REQUEST_TYPES , ExperimentalInvoiceRequestTlvStream , ExperimentalInvoiceRequestTlvStreamRef , INVOICE_REQUEST_PAYER_ID_TYPE , INVOICE_REQUEST_TYPES , IV_BYTES as INVOICE_REQUEST_IV_BYTES , InvoiceRequest , InvoiceRequestContents , InvoiceRequestTlvStream , InvoiceRequestTlvStreamRef } ;
125125use crate :: offers:: merkle:: { SignError , SignFn , SignatureTlvStream , SignatureTlvStreamRef , TaggedHash , TlvStream , self , SIGNATURE_TLV_RECORD_SIZE } ;
126126use crate :: offers:: nonce:: Nonce ;
@@ -380,6 +380,20 @@ macro_rules! invoice_builder_methods { (
380380 }
381381} }
382382
383+ #[ cfg( test) ]
384+ macro_rules! invoice_builder_methods_test { (
385+ $self: ident, $self_type: ty, $return_type: ty, $return_value: expr
386+ $( , $self_mut: tt) ?
387+ ) => {
388+ #[ cfg_attr( c_bindings, allow( dead_code) ) ]
389+ pub ( crate ) fn amount_msats_unchecked(
390+ $( $self_mut) * $self: $self_type, amount_msats: u64 ,
391+ ) -> $return_type {
392+ $self. invoice. fields_mut( ) . amount_msats = amount_msats;
393+ $return_value
394+ }
395+ } }
396+
383397impl < ' a > InvoiceBuilder < ' a , ExplicitSigningPubkey > {
384398 invoice_explicit_signing_pubkey_builder_methods ! ( self , Self ) ;
385399}
@@ -393,7 +407,9 @@ impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> {
393407 invoice_builder_methods_common ! ( self , Self , self . invoice. fields_mut( ) , Self , self , Bolt12Invoice , mut ) ;
394408
395409 #[ cfg( test) ]
396- invoice_builder_methods_test ! ( self , Self , self . invoice. fields_mut( ) , Self , self , mut ) ;
410+ invoice_builder_methods_test ! ( self , Self , Self , self , mut ) ;
411+ #[ cfg( test) ]
412+ invoice_builder_methods_test_common ! ( self , Self , self . invoice. fields_mut( ) , Self , self , mut ) ;
397413}
398414
399415#[ cfg( all( c_bindings, not( test) ) ) ]
@@ -408,7 +424,8 @@ impl<'a> InvoiceWithExplicitSigningPubkeyBuilder<'a> {
408424 invoice_explicit_signing_pubkey_builder_methods ! ( self , & mut Self ) ;
409425 invoice_builder_methods ! ( self , & mut Self , & mut Self , self , ExplicitSigningPubkey ) ;
410426 invoice_builder_methods_common ! ( self , & mut Self , self . invoice. fields_mut( ) , & mut Self , self , Bolt12Invoice ) ;
411- invoice_builder_methods_test ! ( self , & mut Self , self . invoice. fields_mut( ) , & mut Self , self ) ;
427+ invoice_builder_methods_test ! ( self , & mut Self , & mut Self , self ) ;
428+ invoice_builder_methods_test_common ! ( self , & mut Self , self . invoice. fields_mut( ) , & mut Self , self ) ;
412429}
413430
414431#[ cfg( all( c_bindings, not( test) ) ) ]
@@ -423,7 +440,8 @@ impl<'a> InvoiceWithDerivedSigningPubkeyBuilder<'a> {
423440 invoice_derived_signing_pubkey_builder_methods ! ( self , & mut Self ) ;
424441 invoice_builder_methods ! ( self , & mut Self , & mut Self , self , DerivedSigningPubkey ) ;
425442 invoice_builder_methods_common ! ( self , & mut Self , self . invoice. fields_mut( ) , & mut Self , self , Bolt12Invoice ) ;
426- invoice_builder_methods_test ! ( self , & mut Self , self . invoice. fields_mut( ) , & mut Self , self ) ;
443+ invoice_builder_methods_test ! ( self , & mut Self , & mut Self , self ) ;
444+ invoice_builder_methods_test_common ! ( self , & mut Self , self . invoice. fields_mut( ) , & mut Self , self ) ;
427445}
428446
429447#[ cfg( c_bindings) ]
0 commit comments