Struct miniscript::descriptor::Tr
source · 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.
sourcepub fn sanity_check(&self) -> Result<(), Error>
pub fn sanity_check(&self) -> Result<(), Error>
Checks whether the descriptor is safe.
sourcepub fn max_weight_to_satisfy(&self) -> Result<Weight, Error>
pub fn max_weight_to_satisfy(&self) -> Result<Weight, Error>
Computes an upper bound on the difference between a non-satisfied
TxIn
’s segwit_weight
and a satisfied TxIn
’s segwit_weight
Assumes all Schnorr signatures are 66 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) -> Result<usize, Error>
👎Deprecated since 10.0.0: Use max_weight_to_satisfy instead. The method to count bytes was redesigned and the results will differ from max_weight_to_satisfy. For more details check rust-bitcoin/rust-miniscript#476.
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> Tr<Pk>
impl<Pk: MiniscriptKey + ToPublicKey> Tr<Pk>
sourcepub fn script_pubkey(&self) -> ScriptBuf
pub fn script_pubkey(&self) -> ScriptBuf
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 get_satisfaction<S>(
&self,
satisfier: &S
) -> Result<(Vec<Vec<u8>>, ScriptBuf), Error>where
S: Satisfier<Pk>,
pub fn get_satisfaction<S>( &self, satisfier: &S ) -> Result<(Vec<Vec<u8>>, ScriptBuf), 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>>, ScriptBuf), Error>where
S: Satisfier<Pk>,
pub fn get_satisfaction_mall<S>( &self, satisfier: &S ) -> Result<(Vec<Vec<u8>>, ScriptBuf), 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
.
source§impl Tr<DefiniteDescriptorKey>
impl Tr<DefiniteDescriptorKey>
sourcepub fn plan_satisfaction<P>(
&self,
provider: &P
) -> Satisfaction<Placeholder<DefiniteDescriptorKey>>where
P: AssetProvider<DefiniteDescriptorKey>,
pub fn plan_satisfaction<P>( &self, provider: &P ) -> Satisfaction<Placeholder<DefiniteDescriptorKey>>where P: AssetProvider<DefiniteDescriptorKey>,
Returns a plan if the provided assets are sufficient to produce a non-malleable satisfaction
sourcepub fn plan_satisfaction_mall<P>(
&self,
provider: &P
) -> Satisfaction<Placeholder<DefiniteDescriptorKey>>where
P: AssetProvider<DefiniteDescriptorKey>,
pub fn plan_satisfaction_mall<P>( &self, provider: &P ) -> Satisfaction<Placeholder<DefiniteDescriptorKey>>where P: AssetProvider<DefiniteDescriptorKey>,
Returns a plan if the provided assets are sufficient to produce a malleable satisfaction
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> 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: FromStrKey> FromStr for Tr<Pk>
impl<Pk: FromStrKey> FromStr for Tr<Pk>
source§impl<Pk: FromStrKey> FromTree for Tr<Pk>
impl<Pk: FromStrKey> FromTree for Tr<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<Tr<Pk>> for Tr<Pk>
impl<Pk: MiniscriptKey> PartialEq<Tr<Pk>> for Tr<Pk>
source§impl<Pk: MiniscriptKey> PartialOrd<Tr<Pk>> for Tr<Pk>
impl<Pk: MiniscriptKey> PartialOrd<Tr<Pk>> for Tr<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 Tr<P>where
P: MiniscriptKey,
Q: MiniscriptKey,
impl<P, Q> TranslatePk<P, Q> for Tr<P>where P: MiniscriptKey, Q: MiniscriptKey,
source§fn translate_pk<T, E>(
&self,
translate: &mut T
) -> Result<Self::Output, TranslateErr<E>>where
T: Translator<P, Q, E>,
fn translate_pk<T, E>( &self, translate: &mut T ) -> Result<Self::Output, TranslateErr<E>>where T: Translator<P, Q, E>,
Translator
.