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_request::{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, WithoutSignatures, self};
use crate::offers::nonce::Nonce;
impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> {
invoice_builder_methods!(self, Self, Self, self, S, mut);
invoice_builder_methods_common!(self, Self, self.invoice.fields_mut(), Self, self, S, Bolt12Invoice, mut);
+
+ #[cfg(test)]
+ invoice_builder_methods_test!(self, Self, self.invoice.fields_mut(), Self, self, mut);
}
#[cfg(all(c_bindings, not(test)))]
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, ExplicitSigningPubkey, Bolt12Invoice);
+ invoice_builder_methods_test!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self);
}
#[cfg(all(c_bindings, not(test)))]
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, DerivedSigningPubkey, Bolt12Invoice);
+ invoice_builder_methods_test!(self, &mut Self, self.invoice.fields_mut(), &mut Self, self);
}
#[cfg(c_bindings)]
}
} }
+#[cfg(test)]
+macro_rules! invoice_builder_methods_test { (
+ $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 features_unchecked(
+ $($self_mut)* $self: $self_type, features: Bolt12InvoiceFeatures
+ ) -> $return_type {
+ $invoice_fields.features = features;
+ $return_value
+ }
+
+} }
+
macro_rules! invoice_accessors_common { ($self: ident, $contents: expr, $invoice_type: ty) => {
/// Paths to the recipient originating from publicly reachable nodes, including information
/// needed for routing payments across them.
pub(super) use invoice_accessors_common;
pub(super) use invoice_builder_methods_common;
+#[cfg(test)]
+pub(super) use invoice_builder_methods_test;