pub struct ShutdownScript(_);
Expand description
A script pubkey for shutting down a channel as defined by BOLT #2.
Implementations
sourceimpl 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(
version: WitnessVersion,
program: &[u8]
) -> Result<Self, InvalidShutdownScript>
pub fn new_witness_program(
version: WitnessVersion,
program: &[u8]
) -> 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) -> Script
pub fn into_inner(self) -> Script
Converts the shutdown script into the underlying Script
.
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
sourceimpl Clone for ShutdownScript
impl Clone for ShutdownScript
sourcefn clone(&self) -> ShutdownScript
fn clone(&self) -> ShutdownScript
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Display for ShutdownScript
impl Display for ShutdownScript
sourceimpl Into<Script> for ShutdownScript
impl Into<Script> for ShutdownScript
sourceimpl PartialEq<ShutdownScript> for ShutdownScript
impl PartialEq<ShutdownScript> for ShutdownScript
sourcefn eq(&self, other: &ShutdownScript) -> bool
fn eq(&self, other: &ShutdownScript) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl Readable for ShutdownScript
impl Readable for ShutdownScript
sourceimpl TryFrom<(Script, &Features<InitContext>)> for ShutdownScript
impl TryFrom<(Script, &Features<InitContext>)> for ShutdownScript
type Error = InvalidShutdownScript
type Error = InvalidShutdownScript
The type returned in the event of a conversion error.
sourceimpl TryFrom<Script> for ShutdownScript
impl TryFrom<Script> for ShutdownScript
sourceimpl Writeable for ShutdownScript
impl Writeable for ShutdownScript
sourcefn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Gets the length of this object after it has been serialized. This can be overridden to optimize cases where we prepend an object with its length. Read more
impl StructuralPartialEq for ShutdownScript
Auto Trait Implementations
impl RefUnwindSafe for ShutdownScript
impl Send for ShutdownScript
impl Sync for ShutdownScript
impl Unpin for ShutdownScript
impl UnwindSafe for ShutdownScript
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more