[−][src]Enum miniscript::descriptor::Descriptor
Script descriptor
Variants
Bare(Miniscript<Pk, Bare>)
A raw scriptpubkey (including pay-to-pubkey) under Legacy context
Pay-to-Pubkey
Pay-to-PubKey-Hash
Pay-to-Witness-PubKey-Hash
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
ShSortedMulti(SortedMultiVec<Pk, Legacy>)
Sortedmulti under P2SH
WshSortedMulti(SortedMultiVec<Pk, Segwitv0>)
Sortedmulti under P2WSH
ShWshSortedMulti(SortedMultiVec<Pk, Segwitv0>)
Sortedmulti under P2SH-P2WSH
Implementations
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]
&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.
pub fn sanity_check(&self) -> Result<(), Error>
[src]
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
impl<Pk: MiniscriptKey> Descriptor<Pk>
[src]
pub fn address<ToPkCtx: Copy>(
&self,
network: Network,
to_pk_ctx: ToPkCtx
) -> Option<Address> where
Pk: ToPublicKey<ToPkCtx>,
[src]
&self,
network: Network,
to_pk_ctx: ToPkCtx
) -> Option<Address> where
Pk: ToPublicKey<ToPkCtx>,
Computes the Bitcoin address of the descriptor, if one exists
to_pk_ctx
denotes the ToPkCtx required for deriving bitcoin::PublicKey
from MiniscriptKey using ToPublicKey.
If MiniscriptKey is already is bitcoin::PublicKey, then the context
would be NullCtx and [descriptor.DescriptorPublicKeyCtx] if MiniscriptKey is [descriptor.DescriptorPublicKey]
In general, this is defined by generic for the trait [trait.ToPublicKey]
pub fn script_pubkey<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script where
Pk: ToPublicKey<ToPkCtx>,
[src]
Pk: ToPublicKey<ToPkCtx>,
Computes the scriptpubkey of the descriptor
to_pk_ctx
denotes the ToPkCtx required for deriving bitcoin::PublicKey
from MiniscriptKey using ToPublicKey.
If MiniscriptKey is already is bitcoin::PublicKey, then the context
would be NullCtx and [descriptor.DescriptorPublicKeyCtx] if MiniscriptKey is [descriptor.DescriptorPublicKey]
In general, this is defined by generic for the trait ToPublicKey
pub fn unsigned_script_sig<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script where
Pk: ToPublicKey<ToPkCtx>,
[src]
Pk: ToPublicKey<ToPkCtx>,
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).
to_pk_ctx
denotes the ToPkCtx required for deriving bitcoin::PublicKey
from MiniscriptKey using ToPublicKey.
If MiniscriptKey is already is bitcoin::PublicKey, then the context
would be NullCtx and [descriptor.DescriptorPublicKeyCtx] if MiniscriptKey is [descriptor.DescriptorPublicKey]
In general, this is defined by generic for the trait ToPublicKey
pub fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script where
Pk: ToPublicKey<ToPkCtx>,
[src]
Pk: ToPublicKey<ToPkCtx>,
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.
to_pk_ctx
denotes the ToPkCtx required for deriving bitcoin::PublicKey
from MiniscriptKey using ToPublicKey.
If MiniscriptKey is already is bitcoin::PublicKey, then the context
would be NullCtx and [descriptor.DescriptorPublicKeyCtx] if MiniscriptKey is [descriptor.DescriptorPublicKey]
In general, this is defined by generic for the trait ToPublicKey
pub fn get_satisfication<ToPkCtx, S>(
&self,
satisfier: S,
to_pk_ctx: ToPkCtx
) -> Result<(Vec<Vec<u8>>, Script), Error> where
ToPkCtx: Copy,
Pk: ToPublicKey<ToPkCtx>,
S: Satisfier<ToPkCtx, Pk>,
[src]
&self,
satisfier: S,
to_pk_ctx: ToPkCtx
) -> Result<(Vec<Vec<u8>>, Script), Error> where
ToPkCtx: Copy,
Pk: ToPublicKey<ToPkCtx>,
S: Satisfier<ToPkCtx, Pk>,
Returns satisfying witness and scriptSig to spend an
output controlled by the given descriptor if it possible to
construct one using the satisfier S.
to_pk_ctx
denotes the ToPkCtx required for deriving bitcoin::PublicKey
from MiniscriptKey using ToPublicKey.
If MiniscriptKey is already is bitcoin::PublicKey, then the context
would be NullCtx and [descriptor.DescriptorPublicKeyCtx] if MiniscriptKey is [descriptor.DescriptorPublicKey]
In general, this is defined by generic for the trait ToPublicKey
pub fn satisfy<ToPkCtx, S>(
&self,
txin: &mut TxIn,
satisfier: S,
to_pk_ctx: ToPkCtx
) -> Result<(), Error> where
ToPkCtx: Copy,
Pk: ToPublicKey<ToPkCtx>,
S: Satisfier<ToPkCtx, Pk>,
[src]
&self,
txin: &mut TxIn,
satisfier: S,
to_pk_ctx: ToPkCtx
) -> Result<(), Error> where
ToPkCtx: Copy,
Pk: ToPublicKey<ToPkCtx>,
S: Satisfier<ToPkCtx, Pk>,
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<ToPkCtx: Copy>(
&self,
to_pk_ctx: ToPkCtx
) -> Option<usize> where
Pk: ToPublicKey<ToPkCtx>,
[src]
&self,
to_pk_ctx: ToPkCtx
) -> Option<usize> where
Pk: ToPublicKey<ToPkCtx>,
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.
pub fn script_code<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> Script where
Pk: ToPublicKey<ToPkCtx>,
[src]
Pk: ToPublicKey<ToPkCtx>,
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.
to_pk_ctx
denotes the ToPkCtx required for deriving bitcoin::PublicKey
from MiniscriptKey using ToPublicKey.
If MiniscriptKey is already is bitcoin::PublicKey, then the context
would be NullCtx and [descriptor.DescriptorPublicKeyCtx] if MiniscriptKey is [descriptor.DescriptorPublicKey]
In general, this is defined by generic for the trait ToPublicKey
impl Descriptor<DescriptorPublicKey>
[src]
pub fn derive(
&self,
child_number: ChildNumber
) -> Descriptor<DescriptorPublicKey>
[src]
&self,
child_number: ChildNumber
) -> Descriptor<DescriptorPublicKey>
Derives all wildcard keys in the descriptor using the supplied child_number
pub fn parse_descriptor(
s: &str
) -> Result<(Descriptor<DescriptorPublicKey>, KeyMap), Error>
[src]
s: &str
) -> Result<(Descriptor<DescriptorPublicKey>, KeyMap), Error>
Parse a descriptor that may contain secret keys
Internally turns every secret key found into the corresponding public key and then returns a a descriptor that only contains public keys and a map to lookup the secret key given a public key.
pub fn to_string_with_secret(&self, key_map: &KeyMap) -> String
[src]
Serialize a descriptor to string with its secret keys
Trait Implementations
impl<Pk: Clone + MiniscriptKey> Clone for Descriptor<Pk>
[src]
pub fn clone(&self) -> Descriptor<Pk>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Pk: MiniscriptKey> Debug for Descriptor<Pk>
[src]
impl<Pk: MiniscriptKey> Display for Descriptor<Pk>
[src]
impl<Pk: Eq + MiniscriptKey> Eq 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]
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
type Err = Error
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<Descriptor<Pk>, Error>
[src]
impl<Pk> FromTree for Descriptor<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
pub 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: Ord + MiniscriptKey> Ord for Descriptor<Pk>
[src]
pub fn cmp(&self, other: &Descriptor<Pk>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<Pk: PartialEq + MiniscriptKey> PartialEq<Descriptor<Pk>> for Descriptor<Pk>
[src]
pub fn eq(&self, other: &Descriptor<Pk>) -> bool
[src]
pub fn ne(&self, other: &Descriptor<Pk>) -> bool
[src]
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Descriptor<Pk>> for Descriptor<Pk>
[src]
pub fn partial_cmp(&self, other: &Descriptor<Pk>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Descriptor<Pk>) -> bool
[src]
pub fn le(&self, other: &Descriptor<Pk>) -> bool
[src]
pub fn gt(&self, other: &Descriptor<Pk>) -> bool
[src]
pub fn ge(&self, other: &Descriptor<Pk>) -> bool
[src]
impl<Pk: MiniscriptKey> StructuralEq for Descriptor<Pk>
[src]
impl<Pk: MiniscriptKey> StructuralPartialEq for Descriptor<Pk>
[src]
Auto Trait Implementations
impl<Pk> RefUnwindSafe for Descriptor<Pk> where
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
impl<Pk> Send for Descriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
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,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Unpin for Descriptor<Pk> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk> UnwindSafe for Descriptor<Pk> where
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,