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