From c5e3f5fa820a17dc6789db41e3a4a772dc28b068 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 27 Nov 2023 18:51:13 +0000 Subject: [PATCH] Drop the unused `PaymentKey` type 935a716cc6c4fada075e2b740a70bb1b7b349d49 added new wrappers for the various channel keys, including a payment_key. However, the `payment_key` has been unused in lightning since the introduction (and broad requiring) of the `static_remotekey` feature. Thus, we simply remove it (and an incredibly stale TODO) here. --- lightning/src/ln/channel.rs | 2 -- lightning/src/ln/channel_keys.rs | 20 -------------------- 2 files changed, 22 deletions(-) diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 263d0dbd..469eddd6 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -1568,8 +1568,6 @@ impl ChannelContext where SP::Target: SignerProvider { /// will sign and send to our counterparty. /// If an Err is returned, it is a ChannelError::Close (for get_funding_created) fn build_remote_transaction_keys(&self) -> TxCreationKeys { - //TODO: Ensure that the payment_key derived here ends up in the library users' wallet as we - //may see payments to it! let revocation_basepoint = &self.get_holder_pubkeys().revocation_basepoint; let htlc_basepoint = &self.get_holder_pubkeys().htlc_basepoint; let counterparty_pubkeys = self.get_counterparty_pubkeys(); diff --git a/lightning/src/ln/channel_keys.rs b/lightning/src/ln/channel_keys.rs index fbb0162e..d08f1d68 100644 --- a/lightning/src/ln/channel_keys.rs +++ b/lightning/src/ln/channel_keys.rs @@ -111,26 +111,6 @@ impl DelayedPaymentKey { } key_read_write!(DelayedPaymentKey); -/// Master key used in conjunction with per_commitment_point to generate a [localpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel. -/// Also used to generate a commitment number in a commitment transaction or as a Payment Key for a remote node (not us) in an anchor output if `option_static_remotekey` is enabled. -/// Shared by both nodes in a channel establishment message flow. -#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash)] -pub struct PaymentBasepoint(pub PublicKey); -basepoint_impl!(PaymentBasepoint); -key_read_write!(PaymentBasepoint); - - -/// [localpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#localpubkey-local_htlcpubkey-remote_htlcpubkey-local_delayedpubkey-and-remote_delayedpubkey-derivation) is a child key of a payment basepoint, -/// that enables a secure hash-lock for off-chain payments without risk of funds getting stuck or stolen. A payment key is normally shared with a counterparty so that it can generate -/// a commitment transaction's to_remote ouput, which our node can claim in case the counterparty force closes the channel. -#[derive(PartialEq, Eq, Clone, Copy, Debug)] -pub struct PaymentKey(pub PublicKey); - -impl PaymentKey { - key_impl!(PaymentBasepoint, "localpubkey"); -} -key_read_write!(PaymentKey); - /// Master key used in conjunction with per_commitment_point to generate [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel. #[derive(PartialEq, Eq, Clone, Copy, Debug, Hash)] pub struct HtlcBasepoint(pub PublicKey); -- 2.30.2