From 0100dc47eaa86c5342083e2d1e360239569f950a Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Thu, 22 Aug 2024 15:41:16 -0500 Subject: [PATCH] Remove NodeSigner::sign_bolt12_invoice_request Now that invoice requests are signed using transient keys only, remove the corresponding signing method from NodeSigner since it is never used. --- fuzz/src/chanmon_consistency.rs | 7 ------- fuzz/src/full_stack.rs | 7 ------- fuzz/src/onion_message.rs | 7 ------- lightning/src/sign/mod.rs | 31 ------------------------------- lightning/src/util/test_utils.rs | 13 ------------- 5 files changed, 65 deletions(-) diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index 2fb0277e165..eb3c7f7e560 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -58,7 +58,6 @@ use lightning::ln::msgs::{ use lightning::ln::script::ShutdownScript; use lightning::ln::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret}; use lightning::offers::invoice::{BlindedPayInfo, UnsignedBolt12Invoice}; -use lightning::offers::invoice_request::UnsignedInvoiceRequest; use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessagePath}; use lightning::routing::router::{InFlightHtlcs, Path, Route, RouteHop, RouteParameters, Router}; use lightning::sign::{ @@ -337,12 +336,6 @@ impl NodeSigner for KeyProvider { unreachable!() } - fn sign_bolt12_invoice_request( - &self, _invoice_request: &UnsignedInvoiceRequest, - ) -> Result { - unreachable!() - } - fn sign_bolt12_invoice( &self, _invoice: &UnsignedBolt12Invoice, ) -> Result { diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index 9c45c66e1a4..86d558f0097 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -51,7 +51,6 @@ use lightning::ln::peer_handler::{ use lightning::ln::script::ShutdownScript; use lightning::ln::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret}; use lightning::offers::invoice::{BlindedPayInfo, UnsignedBolt12Invoice}; -use lightning::offers::invoice_request::UnsignedInvoiceRequest; use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessagePath}; use lightning::routing::gossip::{NetworkGraph, P2PGossipSync}; use lightning::routing::router::{ @@ -411,12 +410,6 @@ impl NodeSigner for KeyProvider { unreachable!() } - fn sign_bolt12_invoice_request( - &self, _invoice_request: &UnsignedInvoiceRequest, - ) -> Result { - unreachable!() - } - fn sign_bolt12_invoice( &self, _invoice: &UnsignedBolt12Invoice, ) -> Result { diff --git a/fuzz/src/onion_message.rs b/fuzz/src/onion_message.rs index 490b7d72a17..89cf27b7fba 100644 --- a/fuzz/src/onion_message.rs +++ b/fuzz/src/onion_message.rs @@ -12,7 +12,6 @@ use lightning::ln::features::InitFeatures; use lightning::ln::msgs::{self, DecodeError, OnionMessageHandler}; use lightning::ln::script::ShutdownScript; use lightning::offers::invoice::UnsignedBolt12Invoice; -use lightning::offers::invoice_request::UnsignedInvoiceRequest; use lightning::onion_message::async_payments::{ AsyncPaymentsMessageHandler, HeldHtlcAvailable, ReleaseHeldHtlc, }; @@ -230,12 +229,6 @@ impl NodeSigner for KeyProvider { unreachable!() } - fn sign_bolt12_invoice_request( - &self, _invoice_request: &UnsignedInvoiceRequest, - ) -> Result { - unreachable!() - } - fn sign_bolt12_invoice( &self, _invoice: &UnsignedBolt12Invoice, ) -> Result { diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs index a1e087de3a3..cf3728c7771 100644 --- a/lightning/src/sign/mod.rs +++ b/lightning/src/sign/mod.rs @@ -56,7 +56,6 @@ use crate::ln::msgs::{UnsignedChannelAnnouncement, UnsignedGossipMessage}; use crate::ln::script::ShutdownScript; use crate::ln::types::PaymentPreimage; use crate::offers::invoice::UnsignedBolt12Invoice; -use crate::offers::invoice_request::UnsignedInvoiceRequest; use crate::util::ser::{Readable, ReadableArgs, Writeable, Writer}; use crate::util::transaction_utils; @@ -870,21 +869,6 @@ pub trait NodeSigner { &self, hrp_bytes: &[u8], invoice_data: &[u5], recipient: Recipient, ) -> Result; - /// Signs the [`TaggedHash`] of a BOLT 12 invoice request. - /// - /// May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where - /// `invoice_request` is the callee. - /// - /// Implementors may check that the `invoice_request` is expected rather than blindly signing - /// the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with - /// the node's signing key or an ephemeral key to preserve privacy, whichever is associated with - /// [`UnsignedInvoiceRequest::payer_signing_pubkey`]. - /// - /// [`TaggedHash`]: crate::offers::merkle::TaggedHash - fn sign_bolt12_invoice_request( - &self, invoice_request: &UnsignedInvoiceRequest, - ) -> Result; - /// Signs the [`TaggedHash`] of a BOLT 12 invoice. /// /// May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the @@ -2187,15 +2171,6 @@ impl NodeSigner for KeysManager { )) } - fn sign_bolt12_invoice_request( - &self, invoice_request: &UnsignedInvoiceRequest, - ) -> Result { - let message = invoice_request.tagged_hash().as_digest(); - let keys = Keypair::from_secret_key(&self.secp_ctx, &self.node_secret); - let aux_rand = self.get_secure_random_bytes(); - Ok(self.secp_ctx.sign_schnorr_with_aux_rand(message, &keys, &aux_rand)) - } - fn sign_bolt12_invoice( &self, invoice: &UnsignedBolt12Invoice, ) -> Result { @@ -2365,12 +2340,6 @@ impl NodeSigner for PhantomKeysManager { )) } - fn sign_bolt12_invoice_request( - &self, invoice_request: &UnsignedInvoiceRequest, - ) -> Result { - self.inner.sign_bolt12_invoice_request(invoice_request) - } - fn sign_bolt12_invoice( &self, invoice: &UnsignedBolt12Invoice, ) -> Result { diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 74a7f769df1..cee727ec48c 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -35,7 +35,6 @@ use crate::ln::{msgs, wire}; use crate::ln::msgs::LightningError; use crate::ln::script::ShutdownScript; use crate::offers::invoice::{BlindedPayInfo, UnsignedBolt12Invoice}; -use crate::offers::invoice_request::UnsignedInvoiceRequest; use crate::onion_message::messenger::{DefaultMessageRouter, Destination, MessageRouter, OnionMessagePath}; use crate::routing::gossip::{EffectiveCapacity, NetworkGraph, NodeId, RoutingFees}; use crate::routing::utxo::{UtxoLookup, UtxoLookupError, UtxoResult}; @@ -1221,12 +1220,6 @@ impl NodeSigner for TestNodeSigner { unreachable!() } - fn sign_bolt12_invoice_request( - &self, _invoice_request: &UnsignedInvoiceRequest - ) -> Result { - unreachable!() - } - fn sign_bolt12_invoice( &self, _invoice: &UnsignedBolt12Invoice, ) -> Result { @@ -1274,12 +1267,6 @@ impl NodeSigner for TestKeysInterface { self.backing.sign_invoice(hrp_bytes, invoice_data, recipient) } - fn sign_bolt12_invoice_request( - &self, invoice_request: &UnsignedInvoiceRequest - ) -> Result { - self.backing.sign_bolt12_invoice_request(invoice_request) - } - fn sign_bolt12_invoice( &self, invoice: &UnsignedBolt12Invoice, ) -> Result {