Skip to content

Commit

Permalink
Remove NodeSigner::sign_bolt12_invoice_request
Browse files Browse the repository at this point in the history
Now that invoice requests are signed using transient keys only, remove
the corresponding signing method from NodeSigner since it is never used.
  • Loading branch information
jkczyz committed Sep 5, 2024
1 parent 3ebe951 commit 53ba3a9
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 69 deletions.
7 changes: 0 additions & 7 deletions fuzz/src/chanmon_consistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ use lightning::ln::msgs::{
use lightning::ln::script::ShutdownScript;
use lightning::ln::types::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret};
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::{
Expand Down Expand Up @@ -339,12 +338,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, ()> {
Expand Down
7 changes: 0 additions & 7 deletions fuzz/src/full_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ use lightning::ln::peer_handler::{
use lightning::ln::script::ShutdownScript;
use lightning::ln::types::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret};
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::{
Expand Down Expand Up @@ -411,12 +410,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, ()> {
Expand Down
7 changes: 0 additions & 7 deletions fuzz/src/onion_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,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,
};
Expand Down Expand Up @@ -233,12 +232,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, ()> {
Expand Down
4 changes: 0 additions & 4 deletions lightning/src/ln/blinded_payment_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,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};
Expand Down Expand Up @@ -1466,9 +1465,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!() }
Expand Down
31 changes: 0 additions & 31 deletions lightning/src/sign/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2183,15 +2167,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, ()> {
Expand Down Expand Up @@ -2358,12 +2333,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, ()> {
Expand Down
13 changes: 0 additions & 13 deletions lightning/src/util/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -1234,12 +1233,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, ()> {
Expand Down Expand Up @@ -1287,12 +1280,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, ()> {
Expand Down

0 comments on commit 53ba3a9

Please sign in to comment.