[][src]Enum miniscript::descriptor::Descriptor

pub enum Descriptor<Pk: MiniscriptKey> {
    Bare(Miniscript<Pk>),
    Pk(Pk),
    Pkh(Pk),
    Wpkh(Pk),
    ShWpkh(Pk),
    Sh(Miniscript<Pk>),
    Wsh(Miniscript<Pk>),
    ShWsh(Miniscript<Pk>),
}

Script descriptor

Variants

Bare(Miniscript<Pk>)

A raw scriptpubkey (including pay-to-pubkey)

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>)

Pay-to-ScriptHash

Wsh(Miniscript<Pk>)

Pay-to-Witness-ScriptHash

ShWsh(Miniscript<Pk>)

P2SH-P2WSH

Methods

impl<Pk: MiniscriptKey> Descriptor<Pk>[src]

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
[src]

Convert a descriptor using abstract keys to one using specific keys

impl<Pk: MiniscriptKey + ToPublicKey> Descriptor<Pk>[src]

pub fn address(&self, network: Network) -> Option<Address>[src]

Computes the Bitcoin address of the descriptor, if one exists

pub fn script_pubkey(&self) -> Script[src]

Computes the scriptpubkey of the descriptor

pub fn unsigned_script_sig(&self) -> Script[src]

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).

pub fn witness_script(&self) -> Script[src]

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.

pub fn satisfy<S: Satisfier<Pk>>(
    &self,
    txin: &mut TxIn,
    satisfier: S
) -> Result<(), Error>
[src]

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.

pub fn max_satisfaction_weight(&self) -> usize[src]

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.

Trait Implementations

impl<Pk> FromTree for Descriptor<Pk> where
    Pk: MiniscriptKey,
    <Pk as FromStr>::Err: ToString,
    <<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString
[src]

fn from_tree(top: &Tree) -> Result<Descriptor<Pk>, Error>[src]

Parse an expression tree into a descriptor

impl<Pk: MiniscriptKey> Liftable<Pk> for Descriptor<Pk>[src]

impl<Pk: Eq + MiniscriptKey> Eq for Descriptor<Pk>[src]

impl<Pk: Clone + MiniscriptKey> Clone for Descriptor<Pk>[src]

impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Descriptor<Pk>> for Descriptor<Pk>[src]

impl<Pk: Ord + MiniscriptKey> Ord for Descriptor<Pk>[src]

impl<Pk: PartialEq + MiniscriptKey> PartialEq<Descriptor<Pk>> for Descriptor<Pk>[src]

impl<Pk: MiniscriptKey> Display for Descriptor<Pk>[src]

impl<Pk: MiniscriptKey> Debug for Descriptor<Pk>[src]

impl<Pk> FromStr for Descriptor<Pk> where
    Pk: MiniscriptKey,
    <Pk as FromStr>::Err: ToString,
    <<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString
[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

impl<Pk> Unpin for Descriptor<Pk> where
    Pk: Unpin,
    <Pk as MiniscriptKey>::Hash: Unpin

impl<Pk> Sync for Descriptor<Pk> where
    Pk: Send + Sync,
    <Pk as MiniscriptKey>::Hash: Send + Sync

impl<Pk> Send for Descriptor<Pk> where
    Pk: Send + Sync,
    <Pk as MiniscriptKey>::Hash: Send + Sync

impl<Pk> UnwindSafe for Descriptor<Pk> where
    Pk: RefUnwindSafe + UnwindSafe,
    <Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe

impl<Pk> RefUnwindSafe for Descriptor<Pk> where
    Pk: RefUnwindSafe,
    <Pk as MiniscriptKey>::Hash: RefUnwindSafe

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]