[−][src]Enum miniscript::miniscript::decode::Terminal
All AST elements
Variants
1
0
<key>
PkH(Pk::Hash)
DUP HASH160 <keyhash> EQUALVERIFY
After(u32)
n CHECKSEQUENCEVERIFY
Older(u32)
n CHECKLOCKTIMEVERIFY
SIZE 32 EQUALVERIFY SHA256 <hash> EQUAL
SIZE 32 EQUALVERIFY HASH256 <hash> EQUAL
SIZE 32 EQUALVERIFY RIPEMD160 <hash> EQUAL
SIZE 32 EQUALVERIFY HASH160 <hash> EQUAL
Alt(Arc<Miniscript<Pk>>)
TOALTSTACK [E] FROMALTSTACK
Swap(Arc<Miniscript<Pk>>)
SWAP [E1]
Check(Arc<Miniscript<Pk>>)
[Kt]/[Ke] CHECKSIG
DupIf(Arc<Miniscript<Pk>>)
DUP IF [V] ENDIF
Verify(Arc<Miniscript<Pk>>)
[T] VERIFY
NonZero(Arc<Miniscript<Pk>>)
SIZE 0NOTEQUAL IF Fn ENDIF
ZeroNotEqual(Arc<Miniscript<Pk>>)
[X] 0NOTEQUAL
AndV(Arc<Miniscript<Pk>>, Arc<Miniscript<Pk>>)
[V] [T]/[V]/[F]/[Kt]
AndB(Arc<Miniscript<Pk>>, Arc<Miniscript<Pk>>)
[E] [W] BOOLAND
AndOr(Arc<Miniscript<Pk>>, Arc<Miniscript<Pk>>, Arc<Miniscript<Pk>>)
[various] NOTIF [various] ELSE [various] ENDIF
OrB(Arc<Miniscript<Pk>>, Arc<Miniscript<Pk>>)
[E] [W] BOOLOR
OrD(Arc<Miniscript<Pk>>, Arc<Miniscript<Pk>>)
[E] IFDUP NOTIF [T]/[E] ENDIF
OrC(Arc<Miniscript<Pk>>, Arc<Miniscript<Pk>>)
[E] NOTIF [V] ENDIF
OrI(Arc<Miniscript<Pk>>, Arc<Miniscript<Pk>>)
IF [various] ELSE [various] ENDIF
Thresh(usize, Vec<Arc<Miniscript<Pk>>>)
[E] ([W] ADD)* k EQUAL
k (
Methods
impl<Pk: MiniscriptKey> Terminal<Pk>
[src]
pub fn translate_pk<FPk, FPkh, Q, Error>(
&self,
translatefpk: &mut FPk,
translatefpkh: &mut FPkh
) -> Result<Terminal<Q>, Error> where
FPk: FnMut(&Pk) -> Result<Q, Error>,
FPkh: FnMut(&Pk::Hash) -> Result<Q::Hash, Error>,
Q: MiniscriptKey,
[src]
&self,
translatefpk: &mut FPk,
translatefpkh: &mut FPkh
) -> Result<Terminal<Q>, Error> where
FPk: FnMut(&Pk) -> Result<Q, Error>,
FPkh: FnMut(&Pk::Hash) -> Result<Q::Hash, Error>,
Q: MiniscriptKey,
Convert an AST element with one public key type to one of another public key type
impl<Pk: MiniscriptKey + ToPublicKey> Terminal<Pk>
[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) -> Option<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 the fragment is not an E, W or Ke.
pub fn max_dissatisfaction_size(&self, one_cost: usize) -> Option<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 the fragment is not E, W or Ke
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<Pk> FromTree for Terminal<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,
impl<Pk: MiniscriptKey> Liftable<Pk> for Terminal<Pk>
[src]
impl<Pk: Eq + MiniscriptKey> Eq for Terminal<Pk> where
Pk::Hash: Eq,
[src]
Pk::Hash: Eq,
impl<Pk: Clone + MiniscriptKey> Clone for Terminal<Pk> where
Pk::Hash: Clone,
[src]
Pk::Hash: Clone,
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Terminal<Pk>> for Terminal<Pk> where
Pk::Hash: PartialOrd,
[src]
Pk::Hash: PartialOrd,
fn partial_cmp(&self, other: &Terminal<Pk>) -> Option<Ordering>
[src]
fn lt(&self, other: &Terminal<Pk>) -> bool
[src]
fn le(&self, other: &Terminal<Pk>) -> bool
[src]
fn gt(&self, other: &Terminal<Pk>) -> bool
[src]
fn ge(&self, other: &Terminal<Pk>) -> bool
[src]
impl<Pk: PartialEq + MiniscriptKey> PartialEq<Terminal<Pk>> for Terminal<Pk> where
Pk::Hash: PartialEq,
[src]
Pk::Hash: PartialEq,
impl<Pk: Ord + MiniscriptKey> Ord for Terminal<Pk> where
Pk::Hash: Ord,
[src]
Pk::Hash: Ord,
fn cmp(&self, other: &Terminal<Pk>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<Pk: Hash + MiniscriptKey> Hash for Terminal<Pk> where
Pk::Hash: Hash,
[src]
Pk::Hash: Hash,
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<Pk: MiniscriptKey> Debug for Terminal<Pk>
[src]
impl<Pk: MiniscriptKey> Display for Terminal<Pk>
[src]
Auto Trait Implementations
impl<Pk> Send for Terminal<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Unpin for Terminal<Pk> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk> Sync for Terminal<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> UnwindSafe for Terminal<Pk> where
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
impl<Pk> RefUnwindSafe for Terminal<Pk> where
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
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> From<T> for 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.
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,