Enum miniscript::descriptor::Descriptor
source · [−]pub enum Descriptor<Pk: MiniscriptKey> {
Bare(Miniscript<Pk, Legacy>),
Pk(Pk),
Pkh(Pk),
Wpkh(Pk),
ShWpkh(Pk),
Sh(Miniscript<Pk, Legacy>),
Wsh(Miniscript<Pk, Segwitv0>),
ShWsh(Miniscript<Pk, Segwitv0>),
}
Expand description
Script descriptor
Variants
Bare(Miniscript<Pk, Legacy>)
A raw scriptpubkey (including pay-to-pubkey) under Legacy context
Pk(Pk)
Pay-to-Pubkey
Pkh(Pk)
Pay-to-PubKey-Hash
Wpkh(Pk)
Pay-to-Witness-PubKey-Hash
ShWpkh(Pk)
Pay-to-Witness-PubKey-Hash inside P2SH
Sh(Miniscript<Pk, Legacy>)
Pay-to-ScriptHash with Legacy context
Wsh(Miniscript<Pk, Segwitv0>)
Pay-to-Witness-ScriptHash with Segwitv0 context
ShWsh(Miniscript<Pk, Segwitv0>)
P2SH-P2WSH with Segwitv0 context
Implementations
sourceimpl<Pk: MiniscriptKey> Descriptor<Pk>
impl<Pk: MiniscriptKey> Descriptor<Pk>
sourcepub fn translate_pk<Fpk, Fpkh, Q, E>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Result<Descriptor<Q>, E> where
Fpk: FnMut(&Pk) -> Result<Q, E>,
Fpkh: FnMut(&Pk::Hash) -> Result<Q::Hash, E>,
Q: MiniscriptKey,
pub fn translate_pk<Fpk, Fpkh, Q, E>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Result<Descriptor<Q>, E> where
Fpk: FnMut(&Pk) -> Result<Q, E>,
Fpkh: FnMut(&Pk::Hash) -> Result<Q::Hash, E>,
Q: MiniscriptKey,
Convert a descriptor using abstract keys to one using specific keys This will panic if translatefpk returns an uncompressed key when converting to a Segwit descriptor. To prevent this panic, ensure translatefpk returns an error in this case instead.
sourceimpl<Pk: MiniscriptKey + ToPublicKey> Descriptor<Pk>
impl<Pk: MiniscriptKey + ToPublicKey> Descriptor<Pk>
sourcepub fn address(&self, network: Network) -> Option<Address>
pub fn address(&self, network: Network) -> Option<Address>
Computes the Bitcoin address of the descriptor, if one exists
sourcepub fn script_pubkey(&self) -> Script
pub fn script_pubkey(&self) -> Script
Computes the scriptpubkey of the descriptor
sourcepub fn unsigned_script_sig(&self) -> Script
pub fn unsigned_script_sig(&self) -> Script
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.
This is used in Segwit transactions to produce an unsigned transaction whose txid will not change during signing (since only the witness data will change).
sourcepub fn witness_script(&self) -> Script
pub fn witness_script(&self) -> Script
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.
sourcepub fn get_satisfication<S: Satisfier<Pk>>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error>
pub fn get_satisfication<S: Satisfier<Pk>>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error>
Returns satisfying witness and scriptSig to spend an output controlled by the given descriptor if it possible to construct one using the satisfier.
sourcepub fn satisfy<S: Satisfier<Pk>>(
&self,
txin: &mut TxIn,
satisfier: S
) -> Result<(), Error>
pub fn satisfy<S: Satisfier<Pk>>(
&self,
txin: &mut TxIn,
satisfier: S
) -> Result<(), Error>
Attempts to produce a satisfying witness and scriptSig to spend an
output controlled by the given descriptor; add the data to a given
TxIn
output.
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 signatures are 73 bytes, including push opcode and sighash suffix. Includes the weight of the VarInts encoding the scriptSig and witness stack length.
sourcepub fn script_code(&self) -> Script
pub fn script_code(&self) -> Script
Get the scriptCode
of a transaction output.
The scriptCode
is the Script of the previous transaction output being serialized in the
sighash when evaluating a CHECKSIG
& co. OP code.
sourceimpl Descriptor<DescriptorPublicKey>
impl Descriptor<DescriptorPublicKey>
sourcepub fn derive(
&self,
child_number: ChildNumber
) -> Descriptor<DescriptorPublicKey>
pub fn derive(
&self,
child_number: ChildNumber
) -> Descriptor<DescriptorPublicKey>
Derives all wildcard keys in the descriptor using the supplied child_number
Trait Implementations
sourceimpl<Pk: Clone + MiniscriptKey> Clone for Descriptor<Pk>
impl<Pk: Clone + MiniscriptKey> Clone for Descriptor<Pk>
sourcefn clone(&self) -> Descriptor<Pk>
fn clone(&self) -> Descriptor<Pk>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<Pk: MiniscriptKey> Debug for Descriptor<Pk>
impl<Pk: MiniscriptKey> Debug for Descriptor<Pk>
sourceimpl<Pk: MiniscriptKey> Display for Descriptor<Pk>
impl<Pk: MiniscriptKey> Display for Descriptor<Pk>
sourceimpl<Pk> FromStr for Descriptor<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk> FromStr for Descriptor<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
sourceimpl<Pk> FromTree for Descriptor<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk> FromTree for Descriptor<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
sourceimpl<Pk: MiniscriptKey> Liftable<Pk> for Descriptor<Pk>
impl<Pk: MiniscriptKey> Liftable<Pk> for Descriptor<Pk>
sourceimpl<Pk: Ord + MiniscriptKey> Ord for Descriptor<Pk>
impl<Pk: Ord + MiniscriptKey> Ord for Descriptor<Pk>
sourceimpl<Pk: PartialEq + MiniscriptKey> PartialEq<Descriptor<Pk>> for Descriptor<Pk>
impl<Pk: PartialEq + MiniscriptKey> PartialEq<Descriptor<Pk>> for Descriptor<Pk>
sourcefn eq(&self, other: &Descriptor<Pk>) -> bool
fn eq(&self, other: &Descriptor<Pk>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Descriptor<Pk>) -> bool
fn ne(&self, other: &Descriptor<Pk>) -> bool
This method tests for !=
.
sourceimpl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Descriptor<Pk>> for Descriptor<Pk>
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Descriptor<Pk>> for Descriptor<Pk>
sourcefn partial_cmp(&self, other: &Descriptor<Pk>) -> Option<Ordering>
fn partial_cmp(&self, other: &Descriptor<Pk>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl<Pk: Eq + MiniscriptKey> Eq for Descriptor<Pk>
impl<Pk: MiniscriptKey> StructuralEq for Descriptor<Pk>
impl<Pk: MiniscriptKey> StructuralPartialEq for Descriptor<Pk>
Auto Trait Implementations
impl<Pk> RefUnwindSafe for Descriptor<Pk> where
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
impl<Pk> Send for Descriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Sync for Descriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Unpin for Descriptor<Pk> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk> UnwindSafe for Descriptor<Pk> where
Pk: UnwindSafe + RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more