mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 15:02:20 +01:00
Merge pull request #3544 from valentinewallace/2025-01-fix-build
Fix build for `cfg(async_payments)`
This commit is contained in:
commit
2c5a1f67b6
3 changed files with 26 additions and 16 deletions
|
@ -120,7 +120,7 @@ use crate::ln::inbound_payment::{ExpandedKey, IV_LEN};
|
|||
use crate::ln::msgs::DecodeError;
|
||||
use crate::offers::invoice_macros::{invoice_accessors_common, invoice_builder_methods_common};
|
||||
#[cfg(test)]
|
||||
use crate::offers::invoice_macros::invoice_builder_methods_test;
|
||||
use crate::offers::invoice_macros::invoice_builder_methods_test_common;
|
||||
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};
|
||||
use crate::offers::merkle::{SignError, SignFn, SignatureTlvStream, SignatureTlvStreamRef, TaggedHash, TlvStream, self, SIGNATURE_TLV_RECORD_SIZE};
|
||||
use crate::offers::nonce::Nonce;
|
||||
|
@ -380,6 +380,20 @@ macro_rules! invoice_builder_methods { (
|
|||
}
|
||||
} }
|
||||
|
||||
#[cfg(test)]
|
||||
macro_rules! invoice_builder_methods_test { (
|
||||
$self: ident, $self_type: ty, $return_type: ty, $return_value: expr
|
||||
$(, $self_mut: tt)?
|
||||
) => {
|
||||
#[cfg_attr(c_bindings, allow(dead_code))]
|
||||
pub(crate) fn amount_msats_unchecked(
|
||||
$($self_mut)* $self: $self_type, amount_msats: u64,
|
||||
) -> $return_type {
|
||||
$self.invoice.fields_mut().amount_msats = amount_msats;
|
||||
$return_value
|
||||
}
|
||||
} }
|
||||
|
||||
impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey> {
|
||||
invoice_explicit_signing_pubkey_builder_methods!(self, Self);
|
||||
}
|
||||
|
@ -393,7 +407,9 @@ impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> {
|
|||
invoice_builder_methods_common!(self, Self, self.invoice.fields_mut(), Self, self, Bolt12Invoice, mut);
|
||||
|
||||
#[cfg(test)]
|
||||
invoice_builder_methods_test!(self, Self, self.invoice.fields_mut(), Self, self, mut);
|
||||
invoice_builder_methods_test!(self, Self, Self, self, mut);
|
||||
#[cfg(test)]
|
||||
invoice_builder_methods_test_common!(self, Self, self.invoice.fields_mut(), Self, self, mut);
|
||||
}
|
||||
|
||||
#[cfg(all(c_bindings, not(test)))]
|
||||
|
@ -408,7 +424,8 @@ impl<'a> InvoiceWithExplicitSigningPubkeyBuilder<'a> {
|
|||
invoice_explicit_signing_pubkey_builder_methods!(self, &mut Self);
|
||||
invoice_builder_methods!(self, &mut Self, &mut Self, self, ExplicitSigningPubkey);
|
||||
invoice_builder_methods_common!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self, Bolt12Invoice);
|
||||
invoice_builder_methods_test!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self);
|
||||
invoice_builder_methods_test!(self, &mut Self, &mut Self, self);
|
||||
invoice_builder_methods_test_common!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self);
|
||||
}
|
||||
|
||||
#[cfg(all(c_bindings, not(test)))]
|
||||
|
@ -423,7 +440,8 @@ impl<'a> InvoiceWithDerivedSigningPubkeyBuilder<'a> {
|
|||
invoice_derived_signing_pubkey_builder_methods!(self, &mut Self);
|
||||
invoice_builder_methods!(self, &mut Self, &mut Self, self, DerivedSigningPubkey);
|
||||
invoice_builder_methods_common!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self, Bolt12Invoice);
|
||||
invoice_builder_methods_test!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self);
|
||||
invoice_builder_methods_test!(self, &mut Self, &mut Self, self);
|
||||
invoice_builder_methods_test_common!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self);
|
||||
}
|
||||
|
||||
#[cfg(c_bindings)]
|
||||
|
|
|
@ -83,18 +83,10 @@ macro_rules! invoice_builder_methods_common { (
|
|||
} }
|
||||
|
||||
#[cfg(test)]
|
||||
macro_rules! invoice_builder_methods_test { (
|
||||
macro_rules! invoice_builder_methods_test_common { (
|
||||
$self: ident, $self_type: ty, $invoice_fields: expr, $return_type: ty, $return_value: expr
|
||||
$(, $self_mut: tt)?
|
||||
) => {
|
||||
#[cfg_attr(c_bindings, allow(dead_code))]
|
||||
pub(crate) fn amount_msats_unchecked(
|
||||
$($self_mut)* $self: $self_type, amount_msats: u64,
|
||||
) -> $return_type {
|
||||
$invoice_fields.amount_msats = amount_msats;
|
||||
$return_value
|
||||
}
|
||||
|
||||
#[cfg_attr(c_bindings, allow(dead_code))]
|
||||
pub(crate) fn features_unchecked(
|
||||
$($self_mut)* $self: $self_type, features: Bolt12InvoiceFeatures
|
||||
|
@ -154,4 +146,4 @@ macro_rules! invoice_accessors_common { ($self: ident, $contents: expr, $invoice
|
|||
pub(super) use invoice_accessors_common;
|
||||
pub(super) use invoice_builder_methods_common;
|
||||
#[cfg(test)]
|
||||
pub(super) use invoice_builder_methods_test;
|
||||
pub(super) use invoice_builder_methods_test_common;
|
||||
|
|
|
@ -20,7 +20,7 @@ use crate::offers::invoice::{
|
|||
InvoiceTlvStream, InvoiceTlvStreamRef,
|
||||
};
|
||||
#[cfg(test)]
|
||||
use crate::offers::invoice_macros::invoice_builder_methods_test;
|
||||
use crate::offers::invoice_macros::invoice_builder_methods_test_common;
|
||||
use crate::offers::invoice_macros::{invoice_accessors_common, invoice_builder_methods_common};
|
||||
use crate::offers::invoice_request::InvoiceRequest;
|
||||
use crate::offers::merkle::{
|
||||
|
@ -174,7 +174,7 @@ impl<'a> StaticInvoiceBuilder<'a> {
|
|||
invoice_builder_methods_common!(self, Self, self.invoice, Self, self, StaticInvoice, mut);
|
||||
|
||||
#[cfg(test)]
|
||||
invoice_builder_methods_test!(self, Self, self.invoice, Self, self, mut);
|
||||
invoice_builder_methods_test_common!(self, Self, self.invoice, Self, self, mut);
|
||||
}
|
||||
|
||||
/// A semantically valid [`StaticInvoice`] that hasn't been signed.
|
||||
|
|
Loading…
Add table
Reference in a new issue