pub struct Tr<Pk: MiniscriptKey> { /* private fields */ }
Expand description
A taproot descriptor
Implementations§
Source§impl<Pk: MiniscriptKey> Tr<Pk>
impl<Pk: MiniscriptKey> Tr<Pk>
Sourcepub fn internal_key(&self) -> &Pk
pub fn internal_key(&self) -> &Pk
Obtain the internal key of Tr
descriptor
Sourcepub fn iter_scripts(&self) -> TapTreeIter<'_, Pk>
pub fn iter_scripts(&self) -> TapTreeIter<'_, Pk>
Iterate over all scripts in merkle tree. If there is no script path, the iterator
yields None
Sourcepub fn spend_info(&self) -> Arc<TaprootSpendInfo>where
Pk: ToPublicKey,
pub fn spend_info(&self) -> Arc<TaprootSpendInfo>where
Pk: ToPublicKey,
Compute the TaprootSpendInfo
associated with this descriptor if spend data is None
.
If spend data is already computed (i.e it is not None
), this does not recompute it.
TaprootSpendInfo
is only required for spending via the script paths.
Source§impl<Pk: MiniscriptKey + ToPublicKey> Tr<Pk>
impl<Pk: MiniscriptKey + ToPublicKey> Tr<Pk>
Sourcepub fn spk(&self) -> Script
pub fn spk(&self) -> Script
Obtain the corresponding script pubkey for this descriptor
Same asDescriptorTrait::script_pubkey
for this descriptor
Trait Implementations§
Source§impl<Pk: MiniscriptKey> Clone for Tr<Pk>
impl<Pk: MiniscriptKey> Clone for Tr<Pk>
Source§impl<Pk: MiniscriptKey> Debug for Tr<Pk>
impl<Pk: MiniscriptKey> Debug for Tr<Pk>
Source§impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Tr<Pk>
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Tr<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 Tr<Pk>
impl<Pk: MiniscriptKey> Display for Tr<Pk>
Source§impl<Pk: MiniscriptKey> ForEachKey<Pk> for Tr<Pk>
impl<Pk: MiniscriptKey> ForEachKey<Pk> for Tr<Pk>
Source§impl<Pk: MiniscriptKey> From<Tr<Pk>> for Descriptor<Pk>
impl<Pk: MiniscriptKey> From<Tr<Pk>> for Descriptor<Pk>
Source§impl<Pk: MiniscriptKey> Hash for Tr<Pk>
impl<Pk: MiniscriptKey> Hash for Tr<Pk>
Source§impl<Pk: MiniscriptKey> Liftable<Pk> for Tr<Pk>
impl<Pk: MiniscriptKey> Liftable<Pk> for Tr<Pk>
Source§impl<Pk: MiniscriptKey> Ord for Tr<Pk>
impl<Pk: MiniscriptKey> Ord for Tr<Pk>
Source§impl<Pk: MiniscriptKey> PartialEq for Tr<Pk>
impl<Pk: MiniscriptKey> PartialEq for Tr<Pk>
Source§impl<Pk: MiniscriptKey> PartialOrd for Tr<Pk>
impl<Pk: MiniscriptKey> PartialOrd for Tr<Pk>
Source§impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Tr<P>
impl<P: MiniscriptKey, Q: MiniscriptKey> TranslatePk<P, Q> for Tr<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: MiniscriptKey> Eq for Tr<Pk>
Auto Trait Implementations§
impl<Pk> !Freeze for Tr<Pk>
impl<Pk> RefUnwindSafe for Tr<Pk>
impl<Pk> Send for Tr<Pk>
impl<Pk> Sync for Tr<Pk>
impl<Pk> Unpin for Tr<Pk>where
Pk: Unpin,
impl<Pk> UnwindSafe for Tr<Pk>
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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