Struct bitcoin_scripts::WitnessScript
source · [−]pub struct WitnessScript(_);
Expand description
A content of the script from witness
structure; en equivalent of
redeemScript
for witness-based transaction inputs. However, unlike
RedeemScript
, WitnessScript
produce SHA256-based hashes of
WScriptHash
type.
Witness script can be nested within the redeem script in legacy
P2WSH-in-P2SH schemes; for this purpose use RedeemScript::from
method.
Implementations
sourceimpl WitnessScript
impl WitnessScript
sourcepub fn script_hash(&self) -> WScriptHash
pub fn script_hash(&self) -> WScriptHash
Computes script commitment which participates in Witness
or
RedeemScript
.
sourcepub fn to_p2wsh(&self) -> PubkeyScript
pub fn to_p2wsh(&self) -> PubkeyScript
Generates PubkeyScript
matching given witnessScript
for native
SegWit outputs.
sourcepub fn to_p2sh_wsh(&self) -> PubkeyScript
pub fn to_p2sh_wsh(&self) -> PubkeyScript
Generates PubkeyScript
matching given witnessScript
for legacy
P2WSH-in-P2SH outputs.
Trait Implementations
sourceimpl AsMut<<WitnessScript as Wrapper>::Inner> for WitnessScript
impl AsMut<<WitnessScript as Wrapper>::Inner> for WitnessScript
sourceimpl AsRef<<WitnessScript as Wrapper>::Inner> for WitnessScript
impl AsRef<<WitnessScript as Wrapper>::Inner> for WitnessScript
sourceimpl Borrow<<WitnessScript as Wrapper>::Inner> for WitnessScript
impl Borrow<<WitnessScript as Wrapper>::Inner> for WitnessScript
sourceimpl BorrowMut<<WitnessScript as Wrapper>::Inner> for WitnessScript
impl BorrowMut<<WitnessScript as Wrapper>::Inner> for WitnessScript
sourcefn borrow_mut(&mut self) -> &mut <Self as Wrapper>::Inner
fn borrow_mut(&mut self) -> &mut <Self as Wrapper>::Inner
Mutably borrows from an owned value. Read more
sourceimpl Clone for WitnessScript
impl Clone for WitnessScript
sourcefn clone(&self) -> WitnessScript
fn clone(&self) -> WitnessScript
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 Debug for WitnessScript
impl Debug for WitnessScript
sourceimpl Default for WitnessScript
impl Default for WitnessScript
sourcefn default() -> WitnessScript
fn default() -> WitnessScript
Returns the “default value” for a type. Read more
sourceimpl Deref for WitnessScript
impl Deref for WitnessScript
sourceimpl DerefMut for WitnessScript
impl DerefMut for WitnessScript
sourceimpl Display for WitnessScript
impl Display for WitnessScript
sourceimpl From<LockScript> for WitnessScript
impl From<LockScript> for WitnessScript
sourcefn from(lock_script: LockScript) -> Self
fn from(lock_script: LockScript) -> Self
Converts to this type from the input type.
sourceimpl From<Script> for WitnessScript
impl From<Script> for WitnessScript
sourceimpl From<WitnessScript> for Script
impl From<WitnessScript> for Script
sourcefn from(wrapped: WitnessScript) -> Self
fn from(wrapped: WitnessScript) -> Self
Converts to this type from the input type.
sourceimpl From<WitnessScript> for RedeemScript
impl From<WitnessScript> for RedeemScript
sourcefn from(witness_script: WitnessScript) -> Self
fn from(witness_script: WitnessScript) -> Self
Converts to this type from the input type.
sourceimpl From<WitnessScript> for LockScript
impl From<WitnessScript> for LockScript
sourcefn from(witness_script: WitnessScript) -> Self
fn from(witness_script: WitnessScript) -> Self
Converts to this type from the input type.
sourceimpl Hash for WitnessScript
impl Hash for WitnessScript
sourceimpl LowerHex for WitnessScript
impl LowerHex for WitnessScript
sourceimpl Ord for WitnessScript
impl Ord for WitnessScript
sourceimpl PartialEq<WitnessScript> for WitnessScript
impl PartialEq<WitnessScript> for WitnessScript
sourcefn eq(&self, other: &WitnessScript) -> bool
fn eq(&self, other: &WitnessScript) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &WitnessScript) -> bool
fn ne(&self, other: &WitnessScript) -> bool
This method tests for !=
.
sourceimpl PartialOrd<WitnessScript> for WitnessScript
impl PartialOrd<WitnessScript> for WitnessScript
sourcefn partial_cmp(&self, other: &WitnessScript) -> Option<Ordering>
fn partial_cmp(&self, other: &WitnessScript) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Strategy for WitnessScript
impl Strategy for WitnessScript
sourceimpl ToPubkeyScript for WitnessScript
impl ToPubkeyScript for WitnessScript
sourcefn to_pubkey_script(&self, strategy: ConvertInfo) -> Option<PubkeyScript>
fn to_pubkey_script(&self, strategy: ConvertInfo) -> Option<PubkeyScript>
Generates scriptPubkey
for segwit non-taproot contexts. Fails by
returning None
for the following contexts:
ConvertInfo::Bare
since nowitness
structure will be present in the output transaction;ConvertInfo::Hashed
since nowitness
structure will be present in the output transactionConvertInfo::Taproot
since taproot does not have an associatedWitnessScript
.
sourceimpl UpperHex for WitnessScript
impl UpperHex for WitnessScript
sourceimpl Wrapper for WitnessScript
impl Wrapper for WitnessScript
sourcefn from_inner(inner: Self::Inner) -> Self
fn from_inner(inner: Self::Inner) -> Self
Instantiates wrapper type with the inner data
sourcefn as_inner(&self) -> &Self::Inner
fn as_inner(&self) -> &Self::Inner
Returns reference to the inner representation for the wrapper type
sourcefn as_inner_mut(&mut self) -> &mut Self::Inner
fn as_inner_mut(&mut self) -> &mut Self::Inner
Returns a mutable reference to the inner representation for the wrapper type Read more
sourcefn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Unwraps the wrapper returning the inner type
impl Eq for WitnessScript
impl StructuralEq for WitnessScript
impl StructuralPartialEq for WitnessScript
Auto Trait Implementations
impl RefUnwindSafe for WitnessScript
impl Send for WitnessScript
impl Sync for WitnessScript
impl Unpin for WitnessScript
impl UnwindSafe for WitnessScript
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
impl<T> ToHex for T where
T: LowerHex,
impl<T> ToHex for T where
T: LowerHex,
impl<T> ToHex for T where
T: LowerHex,
impl<T> ToHex for T where
T: LowerHex,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more