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(
witness_program: &WitnessProgram,
) -> Result<ShutdownScript, InvalidShutdownScript>
pub fn new_witness_program( witness_program: &WitnessProgram, ) -> 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) -> ScriptBuf
pub fn into_inner(self) -> ScriptBuf
Converts the shutdown script into the underlying ScriptBuf.
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<ScriptBuf> for ShutdownScript
impl Into<ScriptBuf> 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<(ScriptBuf, &Features<InitContext>)> for ShutdownScript
impl TryFrom<(ScriptBuf, &Features<InitContext>)> for ShutdownScript
§type Error = InvalidShutdownScript
type Error = InvalidShutdownScript
§impl TryFrom<ScriptBuf> for ShutdownScript
impl TryFrom<ScriptBuf> for ShutdownScript
§type Error = InvalidShutdownScript
type Error = InvalidShutdownScript
§fn try_from(
script: ScriptBuf,
) -> Result<ShutdownScript, <ShutdownScript as TryFrom<ScriptBuf>>::Error>
fn try_from( script: ScriptBuf, ) -> Result<ShutdownScript, <ShutdownScript as TryFrom<ScriptBuf>>::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<T> AnySync for T
impl<T> AnySync for T
§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,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.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<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
§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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§impl<T> MaybeReadable for Twhere
T: Readable,
impl<T> MaybeReadable for Twhere
T: Readable,
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.