From: Jeffrey Czyz Date: Thu, 13 Jul 2023 18:47:09 +0000 (-0500) Subject: Qualify the BOLT 12 unsigned invoice type X-Git-Tag: v0.0.116-rc1~3^2~9 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=d94227cc13d2dee0ce1a4f24629d6e58a8a8416d;p=rust-lightning Qualify the BOLT 12 unsigned invoice type A previous commit qualified the BOLT 12 invoice type, so any related types should be similarly qualified, if public. --- diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs index f8fe34f2b..dbf62fac7 100644 --- a/fuzz/src/invoice_request_deser.rs +++ b/fuzz/src/invoice_request_deser.rs @@ -14,7 +14,7 @@ use lightning::blinded_path::BlindedPath; use lightning::sign::EntropySource; use lightning::ln::PaymentHash; use lightning::ln::features::BlindedHopFeatures; -use lightning::offers::invoice::{BlindedPayInfo, UnsignedInvoice}; +use lightning::offers::invoice::{BlindedPayInfo, UnsignedBolt12Invoice}; use lightning::offers::invoice_request::InvoiceRequest; use lightning::offers::parse::SemanticError; use lightning::util::ser::Writeable; @@ -71,7 +71,7 @@ fn privkey(byte: u8) -> SecretKey { fn build_response<'a, T: secp256k1::Signing + secp256k1::Verification>( invoice_request: &'a InvoiceRequest, secp_ctx: &Secp256k1 -) -> Result, SemanticError> { +) -> Result, SemanticError> { let entropy_source = Randomness {}; let paths = vec![ BlindedPath::new_for_message(&[pubkey(43), pubkey(44), pubkey(42)], &entropy_source, secp_ctx).unwrap(), diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs index 618b129f9..b1c729d9e 100644 --- a/fuzz/src/refund_deser.rs +++ b/fuzz/src/refund_deser.rs @@ -14,7 +14,7 @@ use lightning::blinded_path::BlindedPath; use lightning::sign::EntropySource; use lightning::ln::PaymentHash; use lightning::ln::features::BlindedHopFeatures; -use lightning::offers::invoice::{BlindedPayInfo, UnsignedInvoice}; +use lightning::offers::invoice::{BlindedPayInfo, UnsignedBolt12Invoice}; use lightning::offers::parse::SemanticError; use lightning::offers::refund::Refund; use lightning::util::ser::Writeable; @@ -60,7 +60,7 @@ fn privkey(byte: u8) -> SecretKey { fn build_response<'a, T: secp256k1::Signing + secp256k1::Verification>( refund: &'a Refund, signing_pubkey: PublicKey, secp_ctx: &Secp256k1 -) -> Result, SemanticError> { +) -> Result, SemanticError> { let entropy_source = Randomness {}; let paths = vec![ BlindedPath::new_for_message(&[pubkey(43), pubkey(44), pubkey(42)], &entropy_source, secp_ctx).unwrap(), diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index 9a09e58ac..8e0c28b60 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -330,8 +330,8 @@ impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> { impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey> { /// Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. It can be signed by - /// [`UnsignedInvoice::sign`]. - pub fn build(self) -> Result, SemanticError> { + /// [`UnsignedBolt12Invoice::sign`]. + pub fn build(self) -> Result, SemanticError> { #[cfg(feature = "std")] { if self.invoice.is_offer_or_refund_expired() { return Err(SemanticError::AlreadyExpired); @@ -339,7 +339,7 @@ impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey> { } let InvoiceBuilder { invreq_bytes, invoice, .. } = self; - Ok(UnsignedInvoice { invreq_bytes, invoice }) + Ok(UnsignedBolt12Invoice { invreq_bytes, invoice }) } } @@ -355,7 +355,7 @@ impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey> { } let InvoiceBuilder { invreq_bytes, invoice, keys, .. } = self; - let unsigned_invoice = UnsignedInvoice { invreq_bytes, invoice }; + let unsigned_invoice = UnsignedBolt12Invoice { invreq_bytes, invoice }; let keys = keys.unwrap(); let invoice = unsigned_invoice @@ -366,12 +366,12 @@ impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey> { } /// A semantically valid [`Bolt12Invoice`] that hasn't been signed. -pub struct UnsignedInvoice<'a> { +pub struct UnsignedBolt12Invoice<'a> { invreq_bytes: &'a Vec, invoice: InvoiceContents, } -impl<'a> UnsignedInvoice<'a> { +impl<'a> UnsignedBolt12Invoice<'a> { /// The public key corresponding to the key needed to sign the invoice. pub fn signing_pubkey(&self) -> PublicKey { self.invoice.fields().signing_pubkey