From 0563a84a2dbd9f87a011c0d94d4ac1c21172f4d1 Mon Sep 17 00:00:00 2001 From: Antoine Riard Date: Tue, 5 May 2020 21:42:51 -0400 Subject: [PATCH] Remove useless build warnings --- lightning/src/chain/keysinterface.rs | 16 ++++------------ lightning/src/ln/channelmonitor.rs | 2 +- lightning/src/ln/functional_tests.rs | 2 +- lightning/src/util/enforcing_trait_impls.rs | 2 -- lightning/src/util/macro_logger.rs | 2 +- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lightning/src/chain/keysinterface.rs b/lightning/src/chain/keysinterface.rs index 2ba6eca3d..6e111980b 100644 --- a/lightning/src/chain/keysinterface.rs +++ b/lightning/src/chain/keysinterface.rs @@ -7,7 +7,6 @@ use bitcoin::blockdata::script::{Script, Builder}; use bitcoin::blockdata::opcodes; use bitcoin::network::constants::Network; use bitcoin::util::bip32::{ExtendedPrivKey, ExtendedPubKey, ChildNumber}; -use bitcoin::util::address::Address; use bitcoin::util::bip143; use bitcoin::hashes::{Hash, HashEngine}; @@ -86,20 +85,13 @@ pub enum SpendableOutputDescriptor { /// The remote_revocation_pubkey used to derive witnessScript remote_revocation_pubkey: PublicKey }, - // TODO: Note that because key is now static and exactly what is provided by us, we should drop - // this in favor of StaticOutput: - /// An output to a P2WPKH, spendable exclusively by the given private key. + /// An output to a P2WPKH, spendable exclusively by our payment key. /// The witness in the spending input, is, thus, simply: /// /// /// These are generally the result of our counterparty having broadcast the current state, /// allowing us to claim the non-HTLC-encumbered outputs immediately. - /// - /// To derive the payment key corresponding to the channel state, you must pass the - /// channel's payment_base_key and the provided per_commitment_point to - /// chan_utils::derive_private_key. The resulting key should be used to sign the spending - /// transaction. - DynamicOutputP2WPKH { + StaticOutputRemotePayment { /// The outpoint which is spendable outpoint: OutPoint, /// The output which is reference by the given outpoint @@ -128,7 +120,7 @@ impl Writeable for SpendableOutputDescriptor { key_derivation_params.1.write(writer)?; remote_revocation_pubkey.write(writer)?; }, - &SpendableOutputDescriptor::DynamicOutputP2WPKH { ref outpoint, ref output, ref key_derivation_params } => { + &SpendableOutputDescriptor::StaticOutputRemotePayment { ref outpoint, ref output, ref key_derivation_params } => { 2u8.write(writer)?; outpoint.write(writer)?; output.write(writer)?; @@ -155,7 +147,7 @@ impl Readable for SpendableOutputDescriptor { key_derivation_params: (Readable::read(reader)?, Readable::read(reader)?), remote_revocation_pubkey: Readable::read(reader)?, }), - 2u8 => Ok(SpendableOutputDescriptor::DynamicOutputP2WPKH { + 2u8 => Ok(SpendableOutputDescriptor::StaticOutputRemotePayment { outpoint: Readable::read(reader)?, output: Readable::read(reader)?, key_derivation_params: (Readable::read(reader)?, Readable::read(reader)?), diff --git a/lightning/src/ln/channelmonitor.rs b/lightning/src/ln/channelmonitor.rs index d4d70691e..638992864 100644 --- a/lightning/src/ln/channelmonitor.rs +++ b/lightning/src/ln/channelmonitor.rs @@ -2188,7 +2188,7 @@ impl ChannelMonitor { break; } } else if self.remote_payment_script == outp.script_pubkey { - spendable_output = Some(SpendableOutputDescriptor::DynamicOutputP2WPKH { + spendable_output = Some(SpendableOutputDescriptor::StaticOutputRemotePayment { outpoint: BitcoinOutPoint { txid: tx.txid(), vout: i as u32 }, output: outp.clone(), key_derivation_params: self.keys.key_derivation_params(), diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs index b62847a45..3a45547ac 100644 --- a/lightning/src/ln/functional_tests.rs +++ b/lightning/src/ln/functional_tests.rs @@ -4097,7 +4097,7 @@ macro_rules! check_spendable_outputs { Event::SpendableOutputs { ref outputs } => { for outp in outputs { match *outp { - SpendableOutputDescriptor::DynamicOutputP2WPKH { ref outpoint, ref output, ref key_derivation_params } => { + SpendableOutputDescriptor::StaticOutputRemotePayment { ref outpoint, ref output, ref key_derivation_params } => { let input = TxIn { previous_output: outpoint.clone(), script_sig: Script::new(), diff --git a/lightning/src/util/enforcing_trait_impls.rs b/lightning/src/util/enforcing_trait_impls.rs index 59a8b5cff..9a1b3ccf9 100644 --- a/lightning/src/util/enforcing_trait_impls.rs +++ b/lightning/src/util/enforcing_trait_impls.rs @@ -1,13 +1,11 @@ use ln::chan_utils::{HTLCOutputInCommitment, TxCreationKeys, ChannelPublicKeys, LocalCommitmentTransaction}; use ln::{chan_utils, msgs}; -use ln::channelmanager::PaymentPreimage; use chain::keysinterface::{ChannelKeys, InMemoryChannelKeys}; use std::cmp; use std::sync::{Mutex, Arc}; use bitcoin::blockdata::transaction::Transaction; -use bitcoin::blockdata::script::Script; use bitcoin::util::bip143; use bitcoin::secp256k1; diff --git a/lightning/src/util/macro_logger.rs b/lightning/src/util/macro_logger.rs index b94540446..c73642862 100644 --- a/lightning/src/util/macro_logger.rs +++ b/lightning/src/util/macro_logger.rs @@ -132,7 +132,7 @@ impl<'a> std::fmt::Display for DebugSpendable<'a> { &SpendableOutputDescriptor::DynamicOutputP2WSH { ref outpoint, .. } => { write!(f, "DynamicOutputP2WSH {}:{} marked for spending", outpoint.txid, outpoint.vout)?; } - &SpendableOutputDescriptor::DynamicOutputP2WPKH { ref outpoint, .. } => { + &SpendableOutputDescriptor::StaticOutputRemotePayment { ref outpoint, .. } => { write!(f, "DynamicOutputP2WPKH {}:{} marked for spending", outpoint.txid, outpoint.vout)?; } } -- 2.39.5