From: Matt Corallo Date: Mon, 27 Nov 2023 18:51:13 +0000 (+0000) Subject: Drop the unused `PaymentKey` type X-Git-Tag: v0.0.120~14^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=c5e3f5fa820a17dc6789db41e3a4a772dc28b068;p=rust-lightning 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. --- diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 263d0dbd2..469eddd64 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 fbb0162e9..d08f1d685 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);