Struct miniscript::descriptor::Sh
source · pub struct Sh<Pk: MiniscriptKey> { /* private fields */ }
Expand description
A Legacy p2sh Descriptor
Implementations§
source§impl<Pk: MiniscriptKey> Sh<Pk>
impl<Pk: MiniscriptKey> Sh<Pk>
sourcepub fn into_inner(self) -> ShInner<Pk>
pub fn into_inner(self) -> ShInner<Pk>
Get the Inner
sourcepub fn new(ms: Miniscript<Pk, Legacy>) -> Result<Self, Error>
pub fn new(ms: Miniscript<Pk, Legacy>) -> Result<Self, Error>
Create a new p2sh descriptor with the raw miniscript
sourcepub fn new_sortedmulti(k: usize, pks: Vec<Pk>) -> Result<Self, Error>
pub fn new_sortedmulti(k: usize, pks: Vec<Pk>) -> Result<Self, Error>
Create a new p2sh sortedmulti descriptor with threshold k
and Vec of pks
.
sourcepub fn new_wsh(ms: Miniscript<Pk, Segwitv0>) -> Result<Self, Error>
pub fn new_wsh(ms: Miniscript<Pk, Segwitv0>) -> Result<Self, Error>
Create a new p2sh wrapped wsh descriptor with the raw miniscript
sourcepub fn new_with_wsh(wsh: Wsh<Pk>) -> Self
pub fn new_with_wsh(wsh: Wsh<Pk>) -> Self
Create a new p2sh wrapper for the given wsh descriptor
sourcepub fn sanity_check(&self) -> Result<(), Error>
pub fn sanity_check(&self) -> Result<(), Error>
Checks whether the descriptor is safe.
sourcepub fn new_wsh_sortedmulti(k: usize, pks: Vec<Pk>) -> Result<Self, Error>
pub fn new_wsh_sortedmulti(k: usize, pks: Vec<Pk>) -> Result<Self, Error>
Create a new p2sh wrapped wsh sortedmulti descriptor from threshold
k
and Vec of pks
sourcepub fn new_with_wpkh(wpkh: Wpkh<Pk>) -> Self
pub fn new_with_wpkh(wpkh: Wpkh<Pk>) -> Self
Create a new p2sh wrapper for the given wpkh descriptor
sourcepub fn max_satisfaction_weight(&self) -> Result<usize, Error>
pub fn max_satisfaction_weight(&self) -> Result<usize, Error>
Computes an upper bound on the weight of a satisfying witness to the transaction.
Assumes all ec-signatures are 73 bytes, including push opcode and sighash suffix. Includes the weight of the VarInts encoding the scriptSig and witness stack length.
Errors
When the descriptor is impossible to safisfy (ex: sh(OP_FALSE)).
source§impl<Pk: MiniscriptKey + ToPublicKey> Sh<Pk>
impl<Pk: MiniscriptKey + ToPublicKey> Sh<Pk>
sourcepub fn script_pubkey(&self) -> Script
pub fn script_pubkey(&self) -> Script
Obtains the corresponding script pubkey for this descriptor.
sourcepub fn address(&self, network: Network) -> Address
pub fn address(&self, network: Network) -> Address
Obtains the corresponding address for this descriptor.
sourcepub fn inner_script(&self) -> Script
pub fn inner_script(&self) -> Script
Obtain the underlying miniscript for this descriptor
sourcepub fn ecdsa_sighash_script_code(&self) -> Script
pub fn ecdsa_sighash_script_code(&self) -> Script
Obtains the pre bip-340 signature script code for this descriptor.
sourcepub fn unsigned_script_sig(&self) -> Script
pub fn unsigned_script_sig(&self) -> Script
Computes the scriptSig that will be in place for an unsigned input spending an output with this descriptor. For pre-segwit descriptors, which use the scriptSig for signatures, this returns the empty script.
This is used in Segwit transactions to produce an unsigned transaction whose txid will not change during signing (since only the witness data will change).
sourcepub fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error>where
S: Satisfier<Pk>,
pub fn get_satisfaction<S>( &self, satisfier: S ) -> Result<(Vec<Vec<u8>>, Script), Error>where S: Satisfier<Pk>,
Returns satisfying non-malleable witness and scriptSig with minimum
weight to spend an output controlled by the given descriptor if it is
possible to construct one using the satisfier
.
sourcepub fn get_satisfaction_mall<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error>where
S: Satisfier<Pk>,
pub fn get_satisfaction_mall<S>( &self, satisfier: S ) -> Result<(Vec<Vec<u8>>, Script), Error>where S: Satisfier<Pk>,
Returns satisfying, possibly malleable, witness and scriptSig with
minimum weight to spend an output controlled by the given descriptor if
it is possible to construct one using the satisfier
.
Trait Implementations§
source§impl<Pk: MiniscriptKey> Debug for Sh<Pk>
impl<Pk: MiniscriptKey> Debug for Sh<Pk>
source§impl<Pk: MiniscriptKey> Display for Sh<Pk>
impl<Pk: MiniscriptKey> Display for Sh<Pk>
source§impl<Pk: MiniscriptKey> ForEachKey<Pk> for Sh<Pk>
impl<Pk: MiniscriptKey> ForEachKey<Pk> for Sh<Pk>
source§impl<Pk: MiniscriptKey> From<Sh<Pk>> for Descriptor<Pk>
impl<Pk: MiniscriptKey> From<Sh<Pk>> for Descriptor<Pk>
source§impl<Pk> FromStr for Sh<Pk>where
Pk: MiniscriptKey + FromStr,
Pk::Sha256: FromStr,
Pk::Hash256: FromStr,
Pk::Ripemd160: FromStr,
Pk::Hash160: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Sha256 as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash256 as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Ripemd160 as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash160 as FromStr>::Err: ToString,
impl<Pk> FromStr for Sh<Pk>where Pk: MiniscriptKey + FromStr, Pk::Sha256: FromStr, Pk::Hash256: FromStr, Pk::Ripemd160: FromStr, Pk::Hash160: FromStr, <Pk as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Sha256 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Hash256 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Ripemd160 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Hash160 as FromStr>::Err: ToString,
source§impl<Pk> FromTree for Sh<Pk>where
Pk: MiniscriptKey + FromStr,
Pk::Sha256: FromStr,
Pk::Hash256: FromStr,
Pk::Ripemd160: FromStr,
Pk::Hash160: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Sha256 as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash256 as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Ripemd160 as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash160 as FromStr>::Err: ToString,
impl<Pk> FromTree for Sh<Pk>where Pk: MiniscriptKey + FromStr, Pk::Sha256: FromStr, Pk::Hash256: FromStr, Pk::Ripemd160: FromStr, Pk::Hash160: FromStr, <Pk as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Sha256 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Hash256 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Ripemd160 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Hash160 as FromStr>::Err: ToString,
source§impl<Pk: MiniscriptKey> Liftable<Pk> for Sh<Pk>
impl<Pk: MiniscriptKey> Liftable<Pk> for Sh<Pk>
source§impl<Pk: Ord + MiniscriptKey> Ord for Sh<Pk>
impl<Pk: Ord + MiniscriptKey> Ord for Sh<Pk>
source§impl<Pk: PartialEq + MiniscriptKey> PartialEq<Sh<Pk>> for Sh<Pk>
impl<Pk: PartialEq + MiniscriptKey> PartialEq<Sh<Pk>> for Sh<Pk>
source§impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Sh<Pk>> for Sh<Pk>
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Sh<Pk>> for Sh<Pk>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<P, Q> TranslatePk<P, Q> for Sh<P>where
P: MiniscriptKey,
Q: MiniscriptKey,
impl<P, Q> TranslatePk<P, Q> for Sh<P>where P: MiniscriptKey, Q: MiniscriptKey,
source§fn translate_pk<T, E>(&self, t: &mut T) -> Result<Self::Output, E>where
T: Translator<P, Q, E>,
fn translate_pk<T, E>(&self, t: &mut T) -> Result<Self::Output, E>where T: Translator<P, Q, E>,
Translator
.