mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-12 22:17:05 +01:00
Remove PayerSigningPubkeyStrategy
Now that InvoiceRequest::payer_signing_pubkey is always a derived pubkey, there is no longer a need for PayerSigningPubkeyStrategy.
This commit is contained in:
parent
d596b4e635
commit
5af0cf1c04
3 changed files with 11 additions and 29 deletions
|
@ -66,7 +66,7 @@ use crate::ln::outbound_payment::{OutboundPayments, PendingOutboundPayment, Retr
|
|||
use crate::ln::wire::Encode;
|
||||
use crate::offers::invoice::{Bolt12Invoice, DEFAULT_RELATIVE_EXPIRY, DerivedSigningPubkey, ExplicitSigningPubkey, InvoiceBuilder, UnsignedBolt12Invoice};
|
||||
use crate::offers::invoice_error::InvoiceError;
|
||||
use crate::offers::invoice_request::{DerivedPayerSigningPubkey, InvoiceRequest, InvoiceRequestBuilder};
|
||||
use crate::offers::invoice_request::{InvoiceRequest, InvoiceRequestBuilder};
|
||||
use crate::offers::nonce::Nonce;
|
||||
use crate::offers::offer::{Offer, OfferBuilder};
|
||||
use crate::offers::parse::Bolt12SemanticError;
|
||||
|
@ -9611,7 +9611,7 @@ where
|
|||
let secp_ctx = &self.secp_ctx;
|
||||
|
||||
let nonce = Nonce::from_entropy_source(entropy);
|
||||
let builder: InvoiceRequestBuilder<DerivedPayerSigningPubkey, secp256k1::All> = offer
|
||||
let builder: InvoiceRequestBuilder<secp256k1::All> = offer
|
||||
.request_invoice(expanded_key, nonce, secp_ctx, payment_id)?
|
||||
.into();
|
||||
let builder = builder.chain_hash(self.chain_hash)?;
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
//! let payment_id = PaymentId([1; 32]);
|
||||
//! let mut buffer = Vec::new();
|
||||
//!
|
||||
//! # use lightning::offers::invoice_request::{DerivedPayerSigningPubkey, InvoiceRequestBuilder};
|
||||
//! # <InvoiceRequestBuilder<DerivedPayerSigningPubkey, _>>::from(
|
||||
//! # use lightning::offers::invoice_request::InvoiceRequestBuilder;
|
||||
//! # <InvoiceRequestBuilder<_>>::from(
|
||||
//! "lno1qcp4256ypq"
|
||||
//! .parse::<Offer>()?
|
||||
//! .request_invoice(&expanded_key, nonce, &secp_ctx, payment_id)?
|
||||
|
@ -111,11 +111,10 @@ pub(super) const IV_BYTES: &[u8; IV_LEN] = b"LDK Invreq ~~~~~";
|
|||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics.
|
||||
///
|
||||
/// [module-level documentation]: self
|
||||
pub struct InvoiceRequestBuilder<'a, 'b, P: PayerSigningPubkeyStrategy, T: secp256k1::Signing> {
|
||||
pub struct InvoiceRequestBuilder<'a, 'b, T: secp256k1::Signing> {
|
||||
offer: &'a Offer,
|
||||
invoice_request: InvoiceRequestContentsWithoutPayerSigningPubkey,
|
||||
payer_signing_pubkey: Option<PublicKey>,
|
||||
payer_signing_pubkey_strategy: core::marker::PhantomData<P>,
|
||||
secp_ctx: Option<&'b Secp256k1<T>>,
|
||||
}
|
||||
|
||||
|
@ -129,22 +128,9 @@ pub struct InvoiceRequestWithDerivedPayerSigningPubkeyBuilder<'a, 'b> {
|
|||
offer: &'a Offer,
|
||||
invoice_request: InvoiceRequestContentsWithoutPayerSigningPubkey,
|
||||
payer_signing_pubkey: Option<PublicKey>,
|
||||
payer_signing_pubkey_strategy: core::marker::PhantomData<DerivedPayerSigningPubkey>,
|
||||
secp_ctx: Option<&'b Secp256k1<secp256k1::All>>,
|
||||
}
|
||||
|
||||
/// Indicates how [`InvoiceRequest::payer_signing_pubkey`] will be set.
|
||||
///
|
||||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics.
|
||||
pub trait PayerSigningPubkeyStrategy {}
|
||||
|
||||
/// [`InvoiceRequest::payer_signing_pubkey`] will be derived.
|
||||
///
|
||||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics.
|
||||
pub struct DerivedPayerSigningPubkey {}
|
||||
|
||||
impl PayerSigningPubkeyStrategy for DerivedPayerSigningPubkey {}
|
||||
|
||||
macro_rules! invoice_request_derived_payer_signing_pubkey_builder_methods { (
|
||||
$self: ident, $self_type: ty, $secp_context: ty
|
||||
) => {
|
||||
|
@ -160,7 +146,6 @@ macro_rules! invoice_request_derived_payer_signing_pubkey_builder_methods { (
|
|||
offer,
|
||||
invoice_request: Self::create_contents(offer, metadata),
|
||||
payer_signing_pubkey: None,
|
||||
payer_signing_pubkey_strategy: core::marker::PhantomData,
|
||||
secp_ctx: Some(secp_ctx),
|
||||
}
|
||||
}
|
||||
|
@ -397,11 +382,8 @@ macro_rules! invoice_request_builder_test_methods { (
|
|||
}
|
||||
} }
|
||||
|
||||
impl<'a, 'b, T: secp256k1::Signing> InvoiceRequestBuilder<'a, 'b, DerivedPayerSigningPubkey, T> {
|
||||
impl<'a, 'b, T: secp256k1::Signing> InvoiceRequestBuilder<'a, 'b, T> {
|
||||
invoice_request_derived_payer_signing_pubkey_builder_methods!(self, Self, T);
|
||||
}
|
||||
|
||||
impl<'a, 'b, P: PayerSigningPubkeyStrategy, T: secp256k1::Signing> InvoiceRequestBuilder<'a, 'b, P, T> {
|
||||
invoice_request_builder_methods!(self, Self, Self, self, T, mut);
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -423,14 +405,14 @@ impl<'a, 'b> InvoiceRequestWithDerivedPayerSigningPubkeyBuilder<'a, 'b> {
|
|||
|
||||
#[cfg(c_bindings)]
|
||||
impl<'a, 'b> From<InvoiceRequestWithDerivedPayerSigningPubkeyBuilder<'a, 'b>>
|
||||
for InvoiceRequestBuilder<'a, 'b, DerivedPayerSigningPubkey, secp256k1::All> {
|
||||
for InvoiceRequestBuilder<'a, 'b, secp256k1::All> {
|
||||
fn from(builder: InvoiceRequestWithDerivedPayerSigningPubkeyBuilder<'a, 'b>) -> Self {
|
||||
let InvoiceRequestWithDerivedPayerSigningPubkeyBuilder {
|
||||
offer, invoice_request, payer_signing_pubkey, payer_signing_pubkey_strategy, secp_ctx,
|
||||
offer, invoice_request, payer_signing_pubkey, secp_ctx,
|
||||
} = builder;
|
||||
|
||||
Self {
|
||||
offer, invoice_request, payer_signing_pubkey, payer_signing_pubkey_strategy, secp_ctx,
|
||||
offer, invoice_request, payer_signing_pubkey, secp_ctx,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ use crate::util::string::PrintableString;
|
|||
|
||||
#[cfg(not(c_bindings))]
|
||||
use {
|
||||
crate::offers::invoice_request::{DerivedPayerSigningPubkey, InvoiceRequestBuilder},
|
||||
crate::offers::invoice_request::InvoiceRequestBuilder,
|
||||
};
|
||||
#[cfg(c_bindings)]
|
||||
use {
|
||||
|
@ -767,7 +767,7 @@ macro_rules! request_invoice_derived_signing_pubkey { ($self: ident, $builder: t
|
|||
|
||||
#[cfg(not(c_bindings))]
|
||||
impl Offer {
|
||||
request_invoice_derived_signing_pubkey!(self, InvoiceRequestBuilder<'a, 'b, DerivedPayerSigningPubkey, T>);
|
||||
request_invoice_derived_signing_pubkey!(self, InvoiceRequestBuilder<'a, 'b, T>);
|
||||
}
|
||||
|
||||
#[cfg(c_bindings)]
|
||||
|
|
Loading…
Add table
Reference in a new issue