Struct elements_miniscript::descriptor::CovenantDescriptor [−][src]
pub struct CovenantDescriptor<Pk: MiniscriptKey> { /* fields omitted */ }
Expand description
The covenant descriptor
Implementations
Get a reference to Miniscript inside covenant
Consume self and return inner miniscript
Create a new Self from components
Encode
Create a satisfaction for the Covenant Descriptor
Script code for signing with covenant publickey. Use this script_code for sighash method when signing with the covenant pk. Use the DescriptorTrait script_code method for getting sighash for regular miniscripts.
Parse a descriptor from script. While parsing other descriptors, we only parse the inner miniscript with ScriptContext. But Covenant descriptors only applicable under Wsh context to avoid implementation complexity.
Trait Implementations
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for CovenantDescriptor<Pk> where
Pk: FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for CovenantDescriptor<Pk> where
Pk: FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
This returns the entire explicit script as the script code. You will need this script code when singing with pks that inside Miniscript. Use the [cov_script_code] method to get the script code for signing with covenant pk
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 Read more
fn address(&self, params: &'static AddressParams) -> Result<Address, Error> where
Pk: ToPublicKey,
fn address(&self, params: &'static AddressParams) -> 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. Read more
Computes the scriptpubkey of the descriptor
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
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. Read more
Returns satisfying witness and scriptSig to spend an output controlled by the given descriptor if it possible to construct one using the satisfier S. Read more
Computes an upper bound on the weight of a satisfying witness to the transaction. Assumes all 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)) Read more
impl<Pk: MiniscriptKey> ElementsTrait<Pk> for CovenantDescriptor<Pk> where
Pk: FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk: MiniscriptKey> ElementsTrait<Pk> for CovenantDescriptor<Pk> where
Pk: FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
fn blind_addr(
&self,
blinder: Option<PublicKey>,
params: &'static AddressParams
) -> Result<Address, Error> where
Pk: ToPublicKey,
fn blind_addr(
&self,
blinder: Option<PublicKey>,
params: &'static AddressParams
) -> Result<Address, Error> where
Pk: ToPublicKey,
Compute a blinded address
Run a predicate on every key in the descriptor, returning whether the predicate returned true for every key Read more
fn for_any_key<'a, F>(&'a self, pred: F) -> bool where
Pk: 'a,
F: FnMut(ForEach<'a, Pk>) -> bool,
<Pk as MiniscriptKey>::Hash: 'a,
fn for_any_key<'a, F>(&'a self, pred: F) -> bool where
Pk: 'a,
F: FnMut(ForEach<'a, Pk>) -> bool,
<Pk as MiniscriptKey>::Hash: 'a,
Run a predicate on every key in the descriptor, returning whether the predicate returned true for any key Read more
impl<Pk: MiniscriptKey> FromStr for CovenantDescriptor<Pk> where
Pk: FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk: MiniscriptKey> FromStr for CovenantDescriptor<Pk> where
Pk: FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk: MiniscriptKey> FromTree for CovenantDescriptor<Pk> where
Pk: FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk: MiniscriptKey> FromTree for CovenantDescriptor<Pk> where
Pk: FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk: PartialEq + MiniscriptKey> PartialEq<CovenantDescriptor<Pk>> for CovenantDescriptor<Pk>
impl<Pk: PartialEq + MiniscriptKey> PartialEq<CovenantDescriptor<Pk>> for CovenantDescriptor<Pk>
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<CovenantDescriptor<Pk>> for CovenantDescriptor<Pk>
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<CovenantDescriptor<Pk>> for CovenantDescriptor<Pk>
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
type Output = CovenantDescriptor<Q>
type Output = CovenantDescriptor<Q>
The associated output type. This must be Self
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 Read more
fn translate_pk_infallible<Fpk, Fpkh>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Self::Output where
Fpk: FnMut(&P) -> Q,
Fpkh: FnMut(&<P as MiniscriptKey>::Hash) -> <Q as MiniscriptKey>::Hash,
fn translate_pk_infallible<Fpk, Fpkh>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Self::Output where
Fpk: FnMut(&P) -> Q,
Fpkh: FnMut(&<P as MiniscriptKey>::Hash) -> <Q as MiniscriptKey>::Hash,
Calls translate_pk
with conversion functions that cannot fail
Auto Trait Implementations
impl<Pk> RefUnwindSafe for CovenantDescriptor<Pk> where
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
impl<Pk> Send for CovenantDescriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Sync for CovenantDescriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Unpin for CovenantDescriptor<Pk> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk> UnwindSafe for CovenantDescriptor<Pk> where
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<P, Q, T> TranslatePk1<P, Q> for T where
P: MiniscriptKey,
Q: MiniscriptKey<Hash = <P as MiniscriptKey>::Hash>,
T: TranslatePk<P, Q>,
impl<P, Q, T> TranslatePk1<P, Q> for T where
P: MiniscriptKey,
Q: MiniscriptKey<Hash = <P as MiniscriptKey>::Hash>,
T: TranslatePk<P, Q>,
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more
impl<P, Q, T> TranslatePk2<P, Q> for T where
P: MiniscriptKey<Hash = P>,
Q: MiniscriptKey,
T: TranslatePk<P, Q>,
impl<P, Q, T> TranslatePk2<P, Q> for T where
P: MiniscriptKey<Hash = P>,
Q: MiniscriptKey,
T: TranslatePk<P, Q>,
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more
impl<P, Q, T> TranslatePk3<P, Q> for T where
P: MiniscriptKey + ToPublicKey,
Q: MiniscriptKey<Hash = Hash>,
T: TranslatePk<P, Q>,
impl<P, Q, T> TranslatePk3<P, Q> for T where
P: MiniscriptKey + ToPublicKey,
Q: MiniscriptKey<Hash = Hash>,
T: TranslatePk<P, Q>,
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more