@@ -330,7 +330,7 @@ macro_rules! invoice_derived_signing_pubkey_builder_methods { ($self: ident, $se
330
330
} }
331
331
332
332
macro_rules! invoice_builder_methods { (
333
- $self: ident, $self_type: ty, $return_type: ty, $return_value: expr, $type_param: ty
333
+ $self: ident, $self_type: ty, $return_type: ty, $return_value: expr, $type_param: ty $ ( , $self_mut : tt ) ?
334
334
) => {
335
335
pub ( crate ) fn amount_msats(
336
336
invoice_request: & InvoiceRequest
@@ -373,7 +373,7 @@ macro_rules! invoice_builder_methods { (
373
373
/// [`Bolt12Invoice::is_expired`].
374
374
///
375
375
/// Successive calls to this method will override the previous setting.
376
- pub fn relative_expiry( mut $self: $self_type, relative_expiry_secs: u32 ) -> $return_type {
376
+ pub fn relative_expiry( $ ( $self_mut ) * $self: $self_type, relative_expiry_secs: u32 ) -> $return_type {
377
377
let relative_expiry = Duration :: from_secs( relative_expiry_secs as u64 ) ;
378
378
$self. invoice. fields_mut( ) . relative_expiry = Some ( relative_expiry) ;
379
379
$return_value
@@ -383,7 +383,7 @@ macro_rules! invoice_builder_methods { (
383
383
///
384
384
/// Successive calls to this method will add another address. Caller is responsible for not
385
385
/// adding duplicate addresses and only calling if capable of receiving to P2WSH addresses.
386
- pub fn fallback_v0_p2wsh( mut $self: $self_type, script_hash: & WScriptHash ) -> $return_type {
386
+ pub fn fallback_v0_p2wsh( $ ( $self_mut ) * $self: $self_type, script_hash: & WScriptHash ) -> $return_type {
387
387
let address = FallbackAddress {
388
388
version: WitnessVersion :: V0 . to_num( ) ,
389
389
program: Vec :: from( script_hash. to_byte_array( ) ) ,
@@ -396,7 +396,7 @@ macro_rules! invoice_builder_methods { (
396
396
///
397
397
/// Successive calls to this method will add another address. Caller is responsible for not
398
398
/// adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses.
399
- pub fn fallback_v0_p2wpkh( mut $self: $self_type, pubkey_hash: & WPubkeyHash ) -> $return_type {
399
+ pub fn fallback_v0_p2wpkh( $ ( $self_mut ) * $self: $self_type, pubkey_hash: & WPubkeyHash ) -> $return_type {
400
400
let address = FallbackAddress {
401
401
version: WitnessVersion :: V0 . to_num( ) ,
402
402
program: Vec :: from( pubkey_hash. to_byte_array( ) ) ,
@@ -409,7 +409,7 @@ macro_rules! invoice_builder_methods { (
409
409
///
410
410
/// Successive calls to this method will add another address. Caller is responsible for not
411
411
/// adding duplicate addresses and only calling if capable of receiving to P2TR addresses.
412
- pub fn fallback_v1_p2tr_tweaked( mut $self: $self_type, output_key: & TweakedPublicKey ) -> $return_type {
412
+ pub fn fallback_v1_p2tr_tweaked( $ ( $self_mut ) * $self: $self_type, output_key: & TweakedPublicKey ) -> $return_type {
413
413
let address = FallbackAddress {
414
414
version: WitnessVersion :: V1 . to_num( ) ,
415
415
program: Vec :: from( & output_key. serialize( ) [ ..] ) ,
@@ -420,7 +420,7 @@ macro_rules! invoice_builder_methods { (
420
420
421
421
/// Sets [`Bolt12Invoice::invoice_features`] to indicate MPP may be used. Otherwise, MPP is
422
422
/// disallowed.
423
- pub fn allow_mpp( mut $self: $self_type) -> $return_type {
423
+ pub fn allow_mpp( $ ( $self_mut ) * $self: $self_type) -> $return_type {
424
424
$self. invoice. fields_mut( ) . features. set_basic_mpp_optional( ) ;
425
425
$return_value
426
426
}
@@ -435,7 +435,7 @@ impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey> {
435
435
}
436
436
437
437
impl < ' a , S : SigningPubkeyStrategy > InvoiceBuilder < ' a , S > {
438
- invoice_builder_methods ! ( self , Self , Self , self , S ) ;
438
+ invoice_builder_methods ! ( self , Self , Self , self , S , mut ) ;
439
439
}
440
440
441
441
#[ cfg( all( c_bindings, not( test) ) ) ]
@@ -525,13 +525,13 @@ impl UnsignedBolt12Invoice {
525
525
}
526
526
}
527
527
528
- macro_rules! unsigned_invoice_sign_method { ( $self: ident, $self_type: ty) => {
528
+ macro_rules! unsigned_invoice_sign_method { ( $self: ident, $self_type: ty $ ( , $self_mut : tt ) ? ) => {
529
529
/// Signs the [`TaggedHash`] of the invoice using the given function.
530
530
///
531
531
/// Note: The hash computation may have included unknown, odd TLV records.
532
532
///
533
533
/// This is not exported to bindings users as functions aren't currently mapped.
534
- pub fn sign<F , E >( mut $self: $self_type, sign: F ) -> Result <Bolt12Invoice , SignError <E >>
534
+ pub fn sign<F , E >( $ ( $self_mut ) * $self: $self_type, sign: F ) -> Result <Bolt12Invoice , SignError <E >>
535
535
where
536
536
F : FnOnce ( & Self ) -> Result <Signature , E >
537
537
{
@@ -554,7 +554,7 @@ macro_rules! unsigned_invoice_sign_method { ($self: ident, $self_type: ty) => {
554
554
} }
555
555
556
556
impl UnsignedBolt12Invoice {
557
- unsigned_invoice_sign_method ! ( self , Self ) ;
557
+ unsigned_invoice_sign_method ! ( self , Self , mut ) ;
558
558
}
559
559
560
560
impl AsRef < TaggedHash > for UnsignedBolt12Invoice {
0 commit comments