]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Remove NodeSigner::sign_bolt12_invoice_request
authorJeffrey Czyz <jkczyz@gmail.com>
Thu, 22 Aug 2024 20:41:16 +0000 (15:41 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Mon, 11 Nov 2024 22:18:11 +0000 (16:18 -0600)
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
fuzz/src/full_stack.rs
fuzz/src/onion_message.rs
lightning/src/ln/blinded_payment_tests.rs
lightning/src/sign/mod.rs
lightning/src/util/test_utils.rs

index 821acfc530111343d49db9f3edfad847b8b58da8..8fdd7b03e21d237d724f3a931df7a52305c955e8 100644 (file)
@@ -57,7 +57,6 @@ use lightning::ln::msgs::{
 use lightning::ln::script::ShutdownScript;
 use lightning::ln::types::ChannelId;
 use lightning::offers::invoice::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::{
@@ -340,12 +339,6 @@ impl NodeSigner for KeyProvider {
                unreachable!()
        }
 
-       fn sign_bolt12_invoice_request(
-               &self, _invoice_request: &UnsignedInvoiceRequest,
-       ) -> Result<schnorr::Signature, ()> {
-               unreachable!()
-       }
-
        fn sign_bolt12_invoice(
                &self, _invoice: &UnsignedBolt12Invoice,
        ) -> Result<schnorr::Signature, ()> {
index 59f1275a600d40d4f9e700af200652e4c71f29fc..fd199ac1629a6d342f701031e47d3579c970a41d 100644 (file)
@@ -50,7 +50,6 @@ use lightning::ln::peer_handler::{
 use lightning::ln::script::ShutdownScript;
 use lightning::ln::types::ChannelId;
 use lightning::offers::invoice::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::{
@@ -413,12 +412,6 @@ impl NodeSigner for KeyProvider {
                unreachable!()
        }
 
-       fn sign_bolt12_invoice_request(
-               &self, _invoice_request: &UnsignedInvoiceRequest,
-       ) -> Result<schnorr::Signature, ()> {
-               unreachable!()
-       }
-
        fn sign_bolt12_invoice(
                &self, _invoice: &UnsignedBolt12Invoice,
        ) -> Result<schnorr::Signature, ()> {
index edf304b5467ff3595132ee1a7f4179bc3c30e76a..59255d0a0e9817fa51351e47d34edebd644334be 100644 (file)
@@ -13,7 +13,6 @@ use lightning::ln::msgs::{self, DecodeError, OnionMessageHandler};
 use lightning::ln::peer_handler::IgnoringMessageHandler;
 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,
 };
@@ -234,12 +233,6 @@ impl NodeSigner for KeyProvider {
                unreachable!()
        }
 
-       fn sign_bolt12_invoice_request(
-               &self, _invoice_request: &UnsignedInvoiceRequest,
-       ) -> Result<schnorr::Signature, ()> {
-               unreachable!()
-       }
-
        fn sign_bolt12_invoice(
                &self, _invoice: &UnsignedBolt12Invoice,
        ) -> Result<schnorr::Signature, ()> {
index aa399b9d4d666399b99900a3bacbccc4e40bd0e6..6fafbe56c540df6283cf06554c10d3aec53911e4 100644 (file)
@@ -27,7 +27,6 @@ use crate::ln::onion_utils;
 use crate::ln::onion_utils::INVALID_ONION_BLINDING;
 use crate::ln::outbound_payment::{Retry, IDEMPOTENCY_TIMEOUT_TICKS};
 use crate::offers::invoice::UnsignedBolt12Invoice;
-use crate::offers::invoice_request::UnsignedInvoiceRequest;
 use crate::prelude::*;
 use crate::routing::router::{BlindedTail, Path, Payee, PaymentParameters, RouteHop, RouteParameters};
 use crate::sign::{KeyMaterial, NodeSigner, Recipient};
@@ -1467,9 +1466,6 @@ fn route_blinding_spec_test_vector() {
                fn sign_invoice(
                        &self, _invoice: &RawBolt11Invoice, _recipient: Recipient,
                ) -> Result<RecoverableSignature, ()> { unreachable!() }
-               fn sign_bolt12_invoice_request(
-                       &self, _invoice_request: &UnsignedInvoiceRequest,
-               ) -> Result<schnorr::Signature, ()> { unreachable!() }
                fn sign_bolt12_invoice(
                        &self, _invoice: &UnsignedBolt12Invoice,
                ) -> Result<schnorr::Signature, ()> { unreachable!() }
index fa463df9388b7772d2ef7507fc52edb402716400..ed4f296b7838e566133b8d3afb0da21ecf730e9d 100644 (file)
@@ -56,7 +56,6 @@ use crate::ln::msgs::PartialSignatureWithNonce;
 use crate::ln::msgs::{UnsignedChannelAnnouncement, UnsignedGossipMessage};
 use crate::ln::script::ShutdownScript;
 use crate::offers::invoice::UnsignedBolt12Invoice;
-use crate::offers::invoice_request::UnsignedInvoiceRequest;
 use crate::types::payment::PaymentPreimage;
 use crate::util::ser::{Readable, ReadableArgs, Writeable, Writer};
 use crate::util::transaction_utils;
@@ -870,21 +869,6 @@ pub trait NodeSigner {
                &self, invoice: &RawBolt11Invoice, recipient: Recipient,
        ) -> Result<RecoverableSignature, ()>;
 
-       /// 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<schnorr::Signature, ()>;
-
        /// Signs the [`TaggedHash`] of a BOLT 12 invoice.
        ///
        /// May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the
@@ -2206,15 +2190,6 @@ impl NodeSigner for KeysManager {
                Ok(self.secp_ctx.sign_ecdsa_recoverable(&hash_to_message!(&hash), secret))
        }
 
-       fn sign_bolt12_invoice_request(
-               &self, invoice_request: &UnsignedInvoiceRequest,
-       ) -> Result<schnorr::Signature, ()> {
-               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<schnorr::Signature, ()> {
@@ -2384,12 +2359,6 @@ impl NodeSigner for PhantomKeysManager {
                Ok(self.inner.secp_ctx.sign_ecdsa_recoverable(&hash_to_message!(&hash), secret))
        }
 
-       fn sign_bolt12_invoice_request(
-               &self, invoice_request: &UnsignedInvoiceRequest,
-       ) -> Result<schnorr::Signature, ()> {
-               self.inner.sign_bolt12_invoice_request(invoice_request)
-       }
-
        fn sign_bolt12_invoice(
                &self, invoice: &UnsignedBolt12Invoice,
        ) -> Result<schnorr::Signature, ()> {
index 122d7f0af48453f504ef80c216065c346b3648ae..813b481c9cfde235a8ef6af2e2da563499bec423 100644 (file)
@@ -34,7 +34,6 @@ use crate::ln::{msgs, wire};
 use crate::ln::msgs::LightningError;
 use crate::ln::script::ShutdownScript;
 use crate::offers::invoice::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};
@@ -1216,12 +1215,6 @@ impl NodeSigner for TestNodeSigner {
                unreachable!()
        }
 
-       fn sign_bolt12_invoice_request(
-               &self, _invoice_request: &UnsignedInvoiceRequest
-       ) -> Result<schnorr::Signature, ()> {
-               unreachable!()
-       }
-
        fn sign_bolt12_invoice(
                &self, _invoice: &UnsignedBolt12Invoice,
        ) -> Result<schnorr::Signature, ()> {
@@ -1269,12 +1262,6 @@ impl NodeSigner for TestKeysInterface {
                self.backing.sign_invoice(invoice, recipient)
        }
 
-       fn sign_bolt12_invoice_request(
-               &self, invoice_request: &UnsignedInvoiceRequest
-       ) -> Result<schnorr::Signature, ()> {
-               self.backing.sign_bolt12_invoice_request(invoice_request)
-       }
-
        fn sign_bolt12_invoice(
                &self, invoice: &UnsignedBolt12Invoice,
        ) -> Result<schnorr::Signature, ()> {