Struct elements_miniscript::descriptor::Pkh
source · pub struct Pkh<Pk: MiniscriptKey> { /* private fields */ }
Expand description
A bare PkH descriptor at top level
Implementations§
source§impl<Pk: MiniscriptKey> Pkh<Pk>
impl<Pk: MiniscriptKey> Pkh<Pk>
sourcepub fn into_inner(self) -> Pk
pub fn into_inner(self) -> Pk
Get the inner key
sourcepub fn max_weight_to_satisfy(&self) -> usize
pub fn max_weight_to_satisfy(&self) -> usize
Computes an upper bound on the difference between a non-satisfied
TxIn
’s segwit_weight
and a satisfied TxIn
’s segwit_weight
Since this method uses segwit_weight
instead of legacy_weight
,
if you want to include only legacy inputs in your transaction,
you should remove 1WU from each input’s max_weight_to_satisfy
for a more accurate estimate.
Assumes all ECDSA signatures are 73 bytes, including push opcode and sighash suffix.
§Errors
When the descriptor is impossible to safisfy (ex: sh(OP_FALSE)).
sourcepub fn max_satisfaction_weight(&self) -> usize
pub fn max_satisfaction_weight(&self) -> usize
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.
source§impl<Pk: MiniscriptKey + ToPublicKey> Pkh<Pk>
impl<Pk: MiniscriptKey + ToPublicKey> Pkh<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,
blinder: Option<PublicKey>,
params: &'static AddressParams
) -> Address
pub fn address( &self, blinder: Option<PublicKey>, params: &'static AddressParams ) -> Address
Obtains the corresponding script pubkey for this descriptor.
sourcepub fn inner_script(&self) -> Script
pub fn inner_script(&self) -> Script
Obtains 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 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 Pkh<Pk>
impl<Pk: MiniscriptKey> Debug for Pkh<Pk>
source§impl<Pk: MiniscriptKey> Display for Pkh<Pk>
impl<Pk: MiniscriptKey> Display for Pkh<Pk>
source§impl<Pk: MiniscriptKey> ForEachKey<Pk> for Pkh<Pk>
impl<Pk: MiniscriptKey> ForEachKey<Pk> for Pkh<Pk>
source§impl<Pk: MiniscriptKey, Ext: Extension> From<Pkh<Pk>> for Descriptor<Pk, Ext>
impl<Pk: MiniscriptKey, Ext: Extension> From<Pkh<Pk>> for Descriptor<Pk, Ext>
source§impl<Pk> FromStr for Pkh<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 Pkh<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 Pkh<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 Pkh<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 Pkh<Pk>
impl<Pk: MiniscriptKey> Liftable<Pk> for Pkh<Pk>
source§impl<Pk: Ord + MiniscriptKey> Ord for Pkh<Pk>
impl<Pk: Ord + MiniscriptKey> Ord for Pkh<Pk>
source§impl<Pk: PartialEq + MiniscriptKey> PartialEq for Pkh<Pk>
impl<Pk: PartialEq + MiniscriptKey> PartialEq for Pkh<Pk>
source§impl<Pk: PartialOrd + MiniscriptKey> PartialOrd for Pkh<Pk>
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd for Pkh<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: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Pkh<P>
impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Pkh<P>
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
.