Struct ShutdownScript
pub struct ShutdownScript(/* private fields */);
Expand description
A script pubkey for shutting down a channel as defined by BOLT #2.
Implementations§
§impl ShutdownScript
impl ShutdownScript
pub fn new_p2wpkh(pubkey_hash: &WPubkeyHash) -> ShutdownScript
pub fn new_p2wpkh(pubkey_hash: &WPubkeyHash) -> ShutdownScript
Generates a P2WPKH script pubkey from the given WPubkeyHash
.
pub fn new_p2wsh(script_hash: &WScriptHash) -> ShutdownScript
pub fn new_p2wsh(script_hash: &WScriptHash) -> ShutdownScript
Generates a P2WSH script pubkey from the given WScriptHash
.
pub fn new_witness_program(
version: WitnessVersion,
program: &[u8],
) -> Result<ShutdownScript, InvalidShutdownScript>
pub fn new_witness_program( version: WitnessVersion, program: &[u8], ) -> Result<ShutdownScript, 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
.
pub fn into_inner(self) -> Script
pub fn into_inner(self) -> Script
Converts the shutdown script into the underlying Script
.
pub 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.
pub fn is_compatible(&self, features: &Features<InitContext>) -> bool
pub fn is_compatible(&self, features: &Features<InitContext>) -> 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§
§impl Clone for ShutdownScript
impl Clone for ShutdownScript
§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 more§impl Display for ShutdownScript
impl Display for ShutdownScript
§impl Into<Script> for ShutdownScript
impl Into<Script> for ShutdownScript
§impl PartialEq for ShutdownScript
impl PartialEq for ShutdownScript
§impl Readable for ShutdownScript
impl Readable for ShutdownScript
§fn read<R>(r: &mut R) -> Result<ShutdownScript, DecodeError>where
R: Read,
fn read<R>(r: &mut R) -> Result<ShutdownScript, DecodeError>where
R: Read,
Self
in from the given Read
.§impl TryFrom<(Script, &Features<InitContext>)> for ShutdownScript
impl TryFrom<(Script, &Features<InitContext>)> for ShutdownScript
§type Error = InvalidShutdownScript
type Error = InvalidShutdownScript
§impl TryFrom<Script> for ShutdownScript
impl TryFrom<Script> for ShutdownScript
§type Error = InvalidShutdownScript
type Error = InvalidShutdownScript
§fn try_from(
script: Script,
) -> Result<ShutdownScript, <ShutdownScript as TryFrom<Script>>::Error>
fn try_from( script: Script, ) -> Result<ShutdownScript, <ShutdownScript as TryFrom<Script>>::Error>
§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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request