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_op_return<T: AsRef<PushBytes>>(
data: T,
) -> Result<Self, InvalidShutdownScript>
pub fn new_op_return<T: AsRef<PushBytes>>( data: T, ) -> Result<Self, InvalidShutdownScript>
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 and/or
option_simple_close.
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 From<ShutdownScript> for ScriptBuf
impl From<ShutdownScript> for ScriptBuf
Source§fn from(value: ShutdownScript) -> Self
fn from(value: ShutdownScript) -> Self
Source§impl PartialEq for ShutdownScript
impl PartialEq for ShutdownScript
Source§impl Readable for ShutdownScript
impl Readable for ShutdownScript
Source§impl TryFrom<ScriptBuf> for ShutdownScript
impl TryFrom<ScriptBuf> for ShutdownScript
Source§impl Writeable for ShutdownScript
impl Writeable for ShutdownScript
impl Eq for ShutdownScript
impl StructuralPartialEq for ShutdownScript
Auto Trait Implementations§
impl Freeze for ShutdownScript
impl RefUnwindSafe for ShutdownScript
impl Send for ShutdownScript
impl Sync for ShutdownScript
impl Unpin for ShutdownScript
impl UnwindSafe for ShutdownScript
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LengthReadable for Twhere
T: Readable,
impl<T> LengthReadable for Twhere
T: Readable,
Source§fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>where
R: LengthLimitedRead,
fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>where
R: LengthLimitedRead,
Self in from the given LengthLimitedRead.