@@ -120,7 +120,7 @@ use crate::ln::inbound_payment::{ExpandedKey, IV_LEN};
120
120
use crate :: ln:: msgs:: DecodeError ;
121
121
use crate :: offers:: invoice_macros:: { invoice_accessors_common, invoice_builder_methods_common} ;
122
122
#[ cfg( test) ]
123
- use crate :: offers:: invoice_macros:: invoice_builder_methods_test ;
123
+ use crate :: offers:: invoice_macros:: invoice_builder_methods_test_common ;
124
124
use 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 } ;
125
125
use crate :: offers:: merkle:: { SignError , SignFn , SignatureTlvStream , SignatureTlvStreamRef , TaggedHash , TlvStream , self , SIGNATURE_TLV_RECORD_SIZE } ;
126
126
use crate :: offers:: nonce:: Nonce ;
@@ -380,6 +380,20 @@ macro_rules! invoice_builder_methods { (
380
380
}
381
381
} }
382
382
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
+
383
397
impl < ' a > InvoiceBuilder < ' a , ExplicitSigningPubkey > {
384
398
invoice_explicit_signing_pubkey_builder_methods ! ( self , Self ) ;
385
399
}
@@ -393,7 +407,9 @@ impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> {
393
407
invoice_builder_methods_common ! ( self , Self , self . invoice. fields_mut( ) , Self , self , Bolt12Invoice , mut ) ;
394
408
395
409
#[ 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 ) ;
397
413
}
398
414
399
415
#[ cfg( all( c_bindings, not( test) ) ) ]
@@ -408,7 +424,8 @@ impl<'a> InvoiceWithExplicitSigningPubkeyBuilder<'a> {
408
424
invoice_explicit_signing_pubkey_builder_methods ! ( self , & mut Self ) ;
409
425
invoice_builder_methods ! ( self , & mut Self , & mut Self , self , ExplicitSigningPubkey ) ;
410
426
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 ) ;
412
429
}
413
430
414
431
#[ cfg( all( c_bindings, not( test) ) ) ]
@@ -423,7 +440,8 @@ impl<'a> InvoiceWithDerivedSigningPubkeyBuilder<'a> {
423
440
invoice_derived_signing_pubkey_builder_methods ! ( self , & mut Self ) ;
424
441
invoice_builder_methods ! ( self , & mut Self , & mut Self , self , DerivedSigningPubkey ) ;
425
442
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 ) ;
427
445
}
428
446
429
447
#[ cfg( c_bindings) ]
0 commit comments