[−][src]Struct miniscript::miniscript::Miniscript
Top-level script AST type
Methods
impl<P: Clone> Miniscript<P>
[src]
pub fn abstract_policy(&self) -> AbstractPolicy<P>
[src]
Abstract the script into an "abstract policy" which can be filtered and analyzed
impl Miniscript<PublicKey>
[src]
pub fn parse(script: &Script) -> Result<Miniscript<PublicKey>, Error>
[src]
Attempt to parse a script into a Miniscript representation
impl<P: ToPublicKey> Miniscript<P>
[src]
pub fn encode(&self) -> Script
[src]
Encode as a Bitcoin script
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_satisfaction_witness_elements(&self) -> usize
[src]
Maximum number of witness elements used to satisfy the Miniscript
fragment, including the witness script itself. Used to estimate
the weight of the VarInt
that specifies this number in a serialized
transaction.
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.)
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.)
impl<P> Miniscript<P>
[src]
pub fn translate<F, Q, E>(&self, translatefn: F) -> Result<Miniscript<Q>, E> where
F: FnMut(&P) -> Result<Q, E>,
[src]
F: FnMut(&P) -> Result<Q, E>,
impl<P: ToPublicKey> Miniscript<P>
[src]
pub fn satisfy<F, H>(
&self,
keyfn: Option<F>,
hashfn: Option<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<F>,
hashfn: Option<H>,
age: u32
) -> Result<Vec<Vec<u8>>, Error> where
F: FnMut(&P) -> Option<(Signature, SigHashType)>,
H: FnMut(Hash) -> Option<[u8; 32]>,
Attempt to produce a satisfying witness for the scriptpubkey represented by the parse tree
impl<P: Clone> Miniscript<P>
[src]
pub fn public_keys(&self) -> Vec<P>
[src]
Return a list of all public keys which might contribute to satisfaction of the scriptpubkey
Trait Implementations
impl<P: Debug + FromStr> FromTree for Miniscript<P> where
<P as FromStr>::Err: ToString,
[src]
<P as FromStr>::Err: ToString,
fn from_tree(top: &Tree) -> Result<Miniscript<P>, Error>
[src]
Parse an expression tree into a Miniscript. As a general rule this should not be called directly; rather go through the output descriptor API.
impl<P: Eq> Eq for Miniscript<P>
[src]
impl<P: Ord> Ord for Miniscript<P>
[src]
fn cmp(&self, other: &Miniscript<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<Miniscript<P>> for Miniscript<P>
[src]
fn eq(&self, other: &Miniscript<P>) -> bool
[src]
fn ne(&self, other: &Miniscript<P>) -> bool
[src]
impl<P: Clone> Clone for Miniscript<P>
[src]
fn clone(&self) -> Miniscript<P>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<P: PartialOrd> PartialOrd<Miniscript<P>> for Miniscript<P>
[src]
fn partial_cmp(&self, other: &Miniscript<P>) -> Option<Ordering>
[src]
fn lt(&self, other: &Miniscript<P>) -> bool
[src]
fn le(&self, other: &Miniscript<P>) -> bool
[src]
fn gt(&self, other: &Miniscript<P>) -> bool
[src]
fn ge(&self, other: &Miniscript<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 Miniscript<P>
[src]
impl<P: Display> Display for Miniscript<P>
[src]
impl<P: Debug + FromStr> FromStr for Miniscript<P> where
<P as FromStr>::Err: ToString,
[src]
<P as FromStr>::Err: ToString,
Auto Trait Implementations
impl<P> Send for Miniscript<P> where
P: Send,
P: Send,
impl<P> Sync for Miniscript<P> where
P: Sync,
P: Sync,
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,