X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fscript.rs;h=c2987f7393ff5d90e10de8229de1869af456d325;hb=633f7329fc7df3015a00e87cb08a06b2d4973707;hp=69b09e958d9f08507529f4da890710b585a77d97;hpb=25a6a77468b3108555cc6ab3b716cd8934584646;p=rust-lightning diff --git a/lightning/src/ln/script.rs b/lightning/src/ln/script.rs index 69b09e95..c2987f73 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