Struct sapio_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>
source§impl<Pk: MiniscriptKey + ToPublicKey> Pkh<Pk>
impl<Pk: MiniscriptKey + ToPublicKey> Pkh<Pk>
sourcepub fn spk(&self) -> Script
pub fn spk(&self) -> Script
Obtain the corresponding script pubkey for this descriptor
Non failing verion of DescriptorTrait::script_pubkey
for this descriptor
sourcepub fn addr(&self, network: Network) -> Address
pub fn addr(&self, network: Network) -> Address
Obtain the corresponding script pubkey for this descriptor
Non failing verion of DescriptorTrait::address
for this descriptor
sourcepub fn inner_script(&self) -> Script
pub fn inner_script(&self) -> Script
Obtain the underlying miniscript for this descriptor
Non failing verion of DescriptorTrait::explicit_script
for this descriptor
sourcepub fn ecdsa_sighash_script_code(&self) -> Script
pub fn ecdsa_sighash_script_code(&self) -> Script
Obtain the pre bip-340 signature script code for this descriptor
Non failing verion of DescriptorTrait::script_code
for this descriptor
Trait Implementations§
source§impl<Pk: MiniscriptKey> Debug for Pkh<Pk>
impl<Pk: MiniscriptKey> Debug for Pkh<Pk>
source§impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Pkh<Pk>
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Pkh<Pk>
source§fn sanity_check(&self) -> Result<(), Error>
fn sanity_check(&self) -> Result<(), Error>
Whether the descriptor is safe
Checks whether all the spend paths in the descriptor are possible
on the bitcoin network under the current standardness and consensus rules
Also checks whether the descriptor requires signauture on all spend paths
And whether the script is malleable.
In general, all the guarantees of miniscript hold only for safe scripts.
All the analysis guarantees of miniscript only hold safe scripts.
The signer may not be able to find satisfactions even if one exists
source§fn address(&self, network: Network) -> Result<Address, Error>where
Pk: ToPublicKey,
fn address(&self, network: Network) -> Result<Address, Error>where
Pk: ToPublicKey,
Computes the Bitcoin address of the descriptor, if one exists
Some descriptors like pk() don’t have any address.
Errors: Read more
source§fn script_pubkey(&self) -> Scriptwhere
Pk: ToPublicKey,
fn script_pubkey(&self) -> Scriptwhere
Pk: ToPublicKey,
Computes the scriptpubkey of the descriptor
source§fn unsigned_script_sig(&self) -> Scriptwhere
Pk: ToPublicKey,
fn unsigned_script_sig(&self) -> Scriptwhere
Pk: ToPublicKey,
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. Read more
source§fn explicit_script(&self) -> Result<Script, Error>where
Pk: ToPublicKey,
fn explicit_script(&self) -> Result<Script, Error>where
Pk: ToPublicKey,
Computes the “witness script” of the descriptor, i.e. the underlying
script before any hashing is done. For
Bare
, Pkh
and Wpkh
this
is the scriptPubkey; for ShWpkh
and Sh
this is the redeemScript;
for the others it is the witness script.
For Tr
descriptors, this will error as there is no underlying scriptsource§fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error>where
Pk: ToPublicKey,
S: Satisfier<Pk>,
fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error>where
Pk: ToPublicKey,
S: Satisfier<Pk>,
Returns satisfying non-malleable witness and scriptSig with minimum weight to spend an
output controlled by the given descriptor if it possible to
construct one using the satisfier S.
source§fn get_satisfaction_mall<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error>where
Pk: ToPublicKey,
S: Satisfier<Pk>,
fn get_satisfaction_mall<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error>where
Pk: ToPublicKey,
S: Satisfier<Pk>,
Returns satisfying, possibly malleable witness and scriptSig to spend an
output controlled by the given descriptor if it possible to
construct one using the satisfier S.
source§fn max_satisfaction_weight(&self) -> Result<usize, Error>
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.
Returns Error when the descriptor is impossible to safisfy (ex: sh(OP_FALSE))
source§fn script_code(&self) -> Result<Script, Error>where
Pk: ToPublicKey,
fn script_code(&self) -> Result<Script, Error>where
Pk: ToPublicKey,
Get the
scriptCode
of a transaction output. Read moresource§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> From<Pkh<Pk>> for Descriptor<Pk>
impl<Pk: MiniscriptKey> From<Pkh<Pk>> for Descriptor<Pk>
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
This method tests less than or equal to (for
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<Fpk, Fpkh, E>(
&self,
translatefpk: Fpk,
_translatefpkh: Fpkh
) -> Result<Self::Output, E>
fn translate_pk<Fpk, Fpkh, E>( &self, translatefpk: Fpk, _translatefpkh: Fpkh ) -> Result<Self::Output, E>
Translate a struct from one Generic to another where the
translation for Pk is provided by translatefpk, and translation for
PkH is provided by translatefpkh
impl<Pk: Eq + MiniscriptKey> Eq for Pkh<Pk>
impl<Pk: MiniscriptKey> PreTaprootDescriptorTrait<Pk> for Pkh<Pk>
impl<Pk: MiniscriptKey> StructuralEq for Pkh<Pk>
impl<Pk: MiniscriptKey> StructuralPartialEq for Pkh<Pk>
Auto Trait Implementations§
impl<Pk> RefUnwindSafe for Pkh<Pk>where
Pk: RefUnwindSafe,
impl<Pk> Send for Pkh<Pk>where
Pk: Send,
impl<Pk> Sync for Pkh<Pk>where
Pk: Sync,
impl<Pk> Unpin for Pkh<Pk>where
Pk: Unpin,
impl<Pk> UnwindSafe for Pkh<Pk>where
Pk: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<P, Q, T> TranslatePk1<P, Q> for T
impl<P, Q, T> TranslatePk1<P, Q> for T
source§fn translate_pk1<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E>
fn translate_pk1<Fpk, E>( &self, translatefpk: Fpk ) -> Result<<Self as TranslatePk<P, Q>>::Output, E>
Translate a struct from one generic to another where the
translation for Pk is provided by translatefpk
source§fn translate_pk1_infallible<Fpk: FnMut(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
fn translate_pk1_infallible<Fpk: FnMut(&P) -> Q>( &self, translatefpk: Fpk ) -> <Self as TranslatePk<P, Q>>::Output
Translate a struct from one generic to another where the
translation for Pk is provided by translatefpk
source§impl<P, Q, T> TranslatePk2<P, Q> for T
impl<P, Q, T> TranslatePk2<P, Q> for T
source§fn translate_pk2<Fpk: Fn(&P) -> Result<Q, E>, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E>
fn translate_pk2<Fpk: Fn(&P) -> Result<Q, E>, E>( &self, translatefpk: Fpk ) -> Result<<Self as TranslatePk<P, Q>>::Output, E>
Translate a struct from one generic to another where the
translation for Pk is provided by translatefpk
source§fn translate_pk2_infallible<Fpk: Fn(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
fn translate_pk2_infallible<Fpk: Fn(&P) -> Q>( &self, translatefpk: Fpk ) -> <Self as TranslatePk<P, Q>>::Output
Translate a struct from one generic to another where the
translation for Pk is provided by translatefpk
source§impl<P, Q, T> TranslatePk3<P, Q> for T
impl<P, Q, T> TranslatePk3<P, Q> for T
source§fn translate_pk3<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E>
fn translate_pk3<Fpk, E>( &self, translatefpk: Fpk ) -> Result<<Self as TranslatePk<P, Q>>::Output, E>
Translate a struct from one generic to another where the
translation for Pk is provided by translatefpk
source§fn translate_pk3_infallible<Fpk: FnMut(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
fn translate_pk3_infallible<Fpk: FnMut(&P) -> Q>( &self, translatefpk: Fpk ) -> <Self as TranslatePk<P, Q>>::Output
Translate a struct from one generic to another where the
translation for Pk is provided by translatefpk