From: Jeffrey Czyz Date: Fri, 30 Jul 2021 23:13:20 +0000 (-0500) Subject: f - Define method for legacy format rather than using From X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=633f7329fc7df3015a00e87cb08a06b2d4973707;p=rust-lightning f - Define method for legacy format rather than using From --- diff --git a/lightning/src/ln/script.rs b/lightning/src/ln/script.rs index 69b09e958..c2987f739 100644 --- a/lightning/src/ln/script.rs +++ b/lightning/src/ln/script.rs @@ -9,7 +9,6 @@ use bitcoin::secp256k1::key::PublicKey; use ln::features::InitFeatures; -use std::convert::From; use std::convert::TryFrom; /// A script pubkey for shutting down a channel as defined by [BOLT #2]. @@ -31,6 +30,11 @@ enum ShutdownScriptImpl { } impl ShutdownScript { + /// Generates a P2WPKH script pubkey from the given [`PublicKey`]. + pub fn new_p2wpkh_from_pubkey(pubkey: PublicKey) -> Self { + Self(ShutdownScriptImpl::Legacy(pubkey)) + } + /// Generates a P2PKH script pubkey from the given [`PubkeyHash`]. pub fn new_p2pkh(pubkey_hash: &PubkeyHash) -> Self { Self(ShutdownScriptImpl::Bolt2(Script::new_p2pkh(pubkey_hash))) @@ -67,12 +71,6 @@ impl ShutdownScript { } } -impl From for ShutdownScript { - fn from(pubkey: PublicKey) -> Self { - Self(ShutdownScriptImpl::Legacy(pubkey)) - } -} - impl TryFrom