[−][src]Enum miniscript::miniscript::astelem::AstElem
All AST elements
Variants
True
1
Pk(P)
<key> CHECKSIG
PkV(P)
<key> CHECKSIGVERIFY
PkQ(P)
<key>
PkW(P)
SWAP <key> CHECKSIG
Multi(usize, Vec<P>)
<k> <keys...> <n> CHECKMULTISIG
MultiV(usize, Vec<P>)
<k> <keys...> <n> CHECKMULTISIGVERIFY
Time(u32)
<n> CHECKSEQUENCEVERIFY
TimeV(u32)
<n> CHECKSEQUENCEVERIFY DROP
TimeF(u32)
<n> CHECKSEQUENCEVERIFY 0NOTEQUAL
TimeE(u32)
DUP IF <n> CHECKSEQUENCEVERIFY DROP ENDIF
TimeW(u32)
SWAP DUP IF <n> CHECKSEQUENCEVERIFY DROP ENDIF
Hash(Hash)
SIZE 32 EQUALVERIFY SHA256 <hash> EQUAL
HashV(Hash)
SIZE 32 EQUALVERIFY SHA256 <hash> EQUALVERIFY
HashW(Hash)
SWAP SIZE 0NOTEQUAL IF SIZE 32 EQUALVERIFY SHA256 <hash> EQUALVERIFY 1 ENDIF
Wrap(Box<AstElem<P>>)
TAS <E> FAS
Likely(Box<AstElem<P>>)
NOTIF <F> ELSE 0 ENDIF
Unlikely(Box<AstElem<P>>)
IF <F> ELSE 0 ENDIF
AndCat(Box<AstElem<P>>, Box<AstElem<P>>)
<V> <T/V/F/Q>
AndBool(Box<AstElem<P>>, Box<AstElem<P>>)
<E> <W> BOOLAND
AndCasc(Box<AstElem<P>>, Box<AstElem<P>>)
<E> NOTIF 0 ELSE <F> ENDIF
OrBool(Box<AstElem<P>>, Box<AstElem<P>>)
<E> <W> BoolOr
OrCasc(Box<AstElem<P>>, Box<AstElem<P>>)
<E> IFDUP NOTIF <T/E> ENDIF
OrCont(Box<AstElem<P>>, Box<AstElem<P>>)
<E> NOTIF <V> ENDIF
OrKey(Box<AstElem<P>>, Box<AstElem<P>>)
IF <Q> ELSE <Q> ENDIF CHECKSIG
OrKeyV(Box<AstElem<P>>, Box<AstElem<P>>)
IF <Q> ELSE <Q> ENDIF CHECKSIGVERIFY
OrIf(Box<AstElem<P>>, Box<AstElem<P>>)
IF <sub1> ELSE <sub2> ENDIF
for many choices of sub1
and sub2
OrIfV(Box<AstElem<P>>, Box<AstElem<P>>)
IF <T> ELSE <T> ENDIF VERIFY
OrNotif(Box<AstElem<P>>, Box<AstElem<P>>)
NOTIF <F> ELSE <E> ENDIF
Thresh(usize, Vec<AstElem<P>>)
<E> (<W> ADD)* <n> EQUAL
ThreshV(usize, Vec<AstElem<P>>)
<E> (<W> ADD)* <n> EQUALVERIFY
Methods
impl<P> AstElem<P>
[src]
pub fn is_e(&self) -> bool
[src]
Does the element satisfy the "expression" calling convention?
pub fn is_q(&self) -> bool
[src]
Does the element satisfy the "queue" calling convention?
pub fn is_w(&self) -> bool
[src]
Does the element satisfy the "wrapped" calling convention?
pub fn is_f(&self) -> bool
[src]
Does the element satisfy the "forced" calling convention?
pub fn is_v(&self) -> bool
[src]
Does the element satisfy the "verify" calling convention?
pub fn is_t(&self) -> bool
[src]
Does the element satisfy the "toplevel" calling convention?
pub fn translate<Func, Q, Error>(
&self,
translatefn: &mut Func
) -> Result<AstElem<Q>, Error> where
Func: FnMut(&P) -> Result<Q, Error>,
[src]
&self,
translatefn: &mut Func
) -> Result<AstElem<Q>, Error> where
Func: FnMut(&P) -> Result<Q, Error>,
Convert an AST element with one public key type to one of another public key type
impl<P: Clone> AstElem<P>
[src]
pub fn abstract_policy(&self) -> AbstractPolicy<P>
[src]
Abstract the script into an "abstract policy" which can be filtered and analyzed
pub fn public_keys(&self) -> Vec<P>
[src]
Return a list of all public keys which might contribute to satisfaction of the scriptpubkey
impl<P: ToPublicKey> AstElem<P>
[src]
pub fn encode(&self, builder: Builder) -> Builder
[src]
Encode the element as a fragment of Bitcoin Script. The inverse
function, from Script to an AST element, is implemented in the
parse
module.
pub fn script_size(&self) -> usize
[src]
Size, in bytes of the script-pubkey. If this Miniscript is used outside of segwit (e.g. in a bare or P2SH descriptor), this quantity should be multiplied by 4 to compute the weight.
In general, it is not recommended to use this function directly, but
to instead call the corresponding function on a Descriptor
, which
will handle the segwit/non-segwit technicalities for you.
pub fn max_dissatisfaction_witness_elements(&self) -> usize
[src]
Maximum number of witness elements used to dissatisfy the Miniscript
fragment. Used to estimate the weight of the VarInt
that specifies
this number in a serialized transaction.
Will panic if you give it a non-E non-W fragment.
pub fn max_dissatisfaction_size(&self, one_cost: usize) -> usize
[src]
Maximum dissatisfaction cost, in bytes, of a Miniscript fragment,
if it is possible to compute this. This function should probably
not ever be used directly. It is called from max_satisfaction_size
.
Will panic if you give it a non-E non-W fragment.
pub fn max_satisfaction_witness_elements(&self) -> usize
[src]
Maximum number of witness elements used to satisfy the Miniscript
fragment. Used to estimate the weight of the VarInt
that specifies
this number in a serialized transaction.
This number does not include the witness script itself, so 1 needs to be added to the final result.
pub fn max_satisfaction_size(&self, one_cost: usize) -> usize
[src]
Maximum size, in bytes, of a satisfying witness. For Segwit outputs
one_cost
should be set to 2, since the number 1
requires two
bytes to encode. For non-segwit outputs one_cost
should be set to
1, since OP_1
is available in scriptSigs.
In general, it is not recommended to use this function directly, but
to instead call the corresponding function on a Descriptor
, which
will handle the segwit/non-segwit technicalities for you.
All signatures are assumed to be 73 bytes in size, including the length prefix (segwit) or push opcode (pre-segwit) and sighash postfix.
This function may panic on misformed Miniscript
objects which do not
correspond to semantically sane Scripts. (Such scripts should be rejected
at parse time. Any exceptions are bugs.)
Trait Implementations
impl<P: ToPublicKey> Satisfiable<P> for AstElem<P>
[src]
fn satisfy<F, H>(
&self,
keyfn: Option<&mut F>,
hashfn: Option<&mut H>,
age: u32
) -> Result<Vec<Vec<u8>>, Error> where
F: FnMut(&P) -> Option<(Signature, SigHashType)>,
H: FnMut(Hash) -> Option<[u8; 32]>,
[src]
&self,
keyfn: Option<&mut F>,
hashfn: Option<&mut H>,
age: u32
) -> Result<Vec<Vec<u8>>, Error> where
F: FnMut(&P) -> Option<(Signature, SigHashType)>,
H: FnMut(Hash) -> Option<[u8; 32]>,
impl<P: ToPublicKey> Dissatisfiable<P> for AstElem<P>
[src]
fn dissatisfy(&self) -> Vec<Vec<u8>>
[src]
impl<P: FromStr> FromTree for AstElem<P> where
<P as FromStr>::Err: ToString,
[src]
<P as FromStr>::Err: ToString,
impl<P: Eq> Eq for AstElem<P>
[src]
impl<P: Ord> Ord for AstElem<P>
[src]
fn cmp(&self, other: &AstElem<P>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl<P: PartialEq> PartialEq<AstElem<P>> for AstElem<P>
[src]
impl<P: Clone> Clone for AstElem<P>
[src]
fn clone(&self) -> AstElem<P>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<P: PartialOrd> PartialOrd<AstElem<P>> for AstElem<P>
[src]
fn partial_cmp(&self, other: &AstElem<P>) -> Option<Ordering>
[src]
fn lt(&self, other: &AstElem<P>) -> bool
[src]
fn le(&self, other: &AstElem<P>) -> bool
[src]
fn gt(&self, other: &AstElem<P>) -> bool
[src]
fn ge(&self, other: &AstElem<P>) -> bool
[src]
impl<P> From<AstElem<P>> for Miniscript<P>
[src]
fn from(t: AstElem<P>) -> Miniscript<P>
[src]
impl<P: Debug> Debug for AstElem<P>
[src]
impl<P: Display> Display for AstElem<P>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,