Struct lightning::ln::script::ShutdownScript
source · pub struct ShutdownScript(/* private fields */);
Expand description
A script pubkey for shutting down a channel as defined by BOLT #2.
Implementations§
source§impl ShutdownScript
impl ShutdownScript
sourcepub fn new_p2wpkh(pubkey_hash: &WPubkeyHash) -> Self
pub fn new_p2wpkh(pubkey_hash: &WPubkeyHash) -> Self
Generates a P2WPKH script pubkey from the given WPubkeyHash
.
sourcepub fn new_p2wsh(script_hash: &WScriptHash) -> Self
pub fn new_p2wsh(script_hash: &WScriptHash) -> Self
Generates a P2WSH script pubkey from the given WScriptHash
.
sourcepub fn new_witness_program(
witness_program: &WitnessProgram
) -> Result<Self, InvalidShutdownScript>
pub fn new_witness_program( witness_program: &WitnessProgram ) -> Result<Self, InvalidShutdownScript>
Generates a witness script pubkey from the given segwit version and program.
Note for version-zero witness scripts you must use ShutdownScript::new_p2wpkh
or
ShutdownScript::new_p2wsh
instead.
§Errors
This function may return an error if program
is invalid for the segwit version
.
sourcepub fn into_inner(self) -> ScriptBuf
pub fn into_inner(self) -> ScriptBuf
Converts the shutdown script into the underlying ScriptBuf
.
sourcepub fn as_legacy_pubkey(&self) -> Option<&PublicKey>
pub fn as_legacy_pubkey(&self) -> Option<&PublicKey>
Returns the PublicKey
used for a P2WPKH shutdown script if constructed directly from it.
sourcepub fn is_compatible(&self, features: &InitFeatures) -> bool
pub fn is_compatible(&self, features: &InitFeatures) -> bool
Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
Specifically, checks for compliance with feature option_shutdown_anysegwit
.
Trait Implementations§
source§impl Clone for ShutdownScript
impl Clone for ShutdownScript
source§fn clone(&self) -> ShutdownScript
fn clone(&self) -> ShutdownScript
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Display for ShutdownScript
impl Display for ShutdownScript
source§impl Into<ScriptBuf> for ShutdownScript
impl Into<ScriptBuf> for ShutdownScript
source§impl PartialEq for ShutdownScript
impl PartialEq for ShutdownScript
source§fn eq(&self, other: &ShutdownScript) -> bool
fn eq(&self, other: &ShutdownScript) -> bool
self
and other
values to be equal, and is used
by ==
.