[−]Enum bdk::descriptor::Terminal
All AST elements
Variants
1
0
<key>
PkH(<Pk as MiniscriptKey>::Hash)
DUP HASH160 <keyhash> EQUALVERIFY
After(u32)
n CHECKLOCKTIMEVERIFY
Older(u32)
n CHECKSEQUENCEVERIFY
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, Ctx>>)
TOALTSTACK [E] FROMALTSTACK
Swap(Arc<Miniscript<Pk, Ctx>>)
SWAP [E1]
Check(Arc<Miniscript<Pk, Ctx>>)
[Kt]/[Ke] CHECKSIG
DupIf(Arc<Miniscript<Pk, Ctx>>)
DUP IF [V] ENDIF
Verify(Arc<Miniscript<Pk, Ctx>>)
[T] VERIFY
NonZero(Arc<Miniscript<Pk, Ctx>>)
SIZE 0NOTEQUAL IF Fn ENDIF
ZeroNotEqual(Arc<Miniscript<Pk, Ctx>>)
[X] 0NOTEQUAL
AndV(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)
[V] [T]/[V]/[F]/[Kt]
AndB(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)
[E] [W] BOOLAND
AndOr(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)
[various] NOTIF [various] ELSE [various] ENDIF
OrB(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)
[E] [W] BOOLOR
OrD(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)
[E] IFDUP NOTIF [T]/[E] ENDIF
OrC(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)
[E] NOTIF [V] ENDIF
OrI(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)
IF [various] ELSE [various] ENDIF
Thresh(usize, Vec<Arc<Miniscript<Pk, Ctx>>>)
[E] ([W] ADD)* k EQUAL
k (
Implementations
impl<Pk, Ctx> Terminal<Pk, Ctx> where
Ctx: ScriptContext,
Pk: MiniscriptKey,
Ctx: ScriptContext,
Pk: MiniscriptKey,
pub fn translate_pk<FPk, FPkh, Q, Error>(
&self,
translatefpk: &mut FPk,
translatefpkh: &mut FPkh
) -> Result<Terminal<Q, Ctx>, Error> where
FPk: FnMut(&Pk) -> Result<Q, Error>,
FPkh: FnMut(&<Pk as MiniscriptKey>::Hash) -> Result<<Q as MiniscriptKey>::Hash, Error>,
Q: MiniscriptKey,
&self,
translatefpk: &mut FPk,
translatefpkh: &mut FPkh
) -> Result<Terminal<Q, Ctx>, Error> where
FPk: FnMut(&Pk) -> Result<Q, Error>,
FPkh: FnMut(&<Pk as MiniscriptKey>::Hash) -> Result<<Q as MiniscriptKey>::Hash, Error>,
Q: MiniscriptKey,
Convert an AST element with one public key type to one of another public key type .This will panic while converting to Segwit Miniscript using uncompressed public keys
impl<Pk, Ctx> Terminal<Pk, Ctx> where
Ctx: ScriptContext,
Pk: MiniscriptKey + ToPublicKey,
Ctx: ScriptContext,
Pk: MiniscriptKey + ToPublicKey,
pub fn encode(&self, builder: Builder) -> Builder
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
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>
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>
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
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
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, Ctx> Clone for Terminal<Pk, Ctx> where
Ctx: ScriptContext + Clone,
Pk: MiniscriptKey + Clone,
<Pk as MiniscriptKey>::Hash: Clone,
Ctx: ScriptContext + Clone,
Pk: MiniscriptKey + Clone,
<Pk as MiniscriptKey>::Hash: Clone,
fn clone(&self) -> Terminal<Pk, Ctx>
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Pk, Ctx> Debug for Terminal<Pk, Ctx> where
Ctx: ScriptContext,
Pk: MiniscriptKey,
Ctx: ScriptContext,
Pk: MiniscriptKey,
impl<Pk, Ctx> Display for Terminal<Pk, Ctx> where
Ctx: ScriptContext,
Pk: MiniscriptKey,
Ctx: ScriptContext,
Pk: MiniscriptKey,
impl<Pk, Ctx> Eq for Terminal<Pk, Ctx> where
Ctx: ScriptContext + Eq,
Pk: MiniscriptKey + Eq,
<Pk as MiniscriptKey>::Hash: Eq,
Ctx: ScriptContext + Eq,
Pk: MiniscriptKey + Eq,
<Pk as MiniscriptKey>::Hash: Eq,
impl<Pk, Ctx> FromTree for Terminal<Pk, Ctx> where
Ctx: ScriptContext,
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
Ctx: ScriptContext,
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk, Ctx> Hash for Terminal<Pk, Ctx> where
Ctx: ScriptContext + Hash,
Pk: MiniscriptKey + Hash,
<Pk as MiniscriptKey>::Hash: Hash,
Ctx: ScriptContext + Hash,
Pk: MiniscriptKey + Hash,
<Pk as MiniscriptKey>::Hash: Hash,
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<Pk, Ctx> Liftable<Pk> for Terminal<Pk, Ctx> where
Ctx: ScriptContext,
Pk: MiniscriptKey,
Ctx: ScriptContext,
Pk: MiniscriptKey,
fn lift(&self) -> Policy<Pk>
impl<Pk, Ctx> Ord for Terminal<Pk, Ctx> where
Ctx: ScriptContext + Ord,
Pk: MiniscriptKey + Ord,
<Pk as MiniscriptKey>::Hash: Ord,
Ctx: ScriptContext + Ord,
Pk: MiniscriptKey + Ord,
<Pk as MiniscriptKey>::Hash: Ord,
fn cmp(&self, other: &Terminal<Pk, Ctx>) -> Ordering
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<Pk, Ctx> PartialEq<Terminal<Pk, Ctx>> for Terminal<Pk, Ctx> where
Ctx: ScriptContext + PartialEq<Ctx>,
Pk: MiniscriptKey + PartialEq<Pk>,
<Pk as MiniscriptKey>::Hash: PartialEq<<Pk as MiniscriptKey>::Hash>,
Ctx: ScriptContext + PartialEq<Ctx>,
Pk: MiniscriptKey + PartialEq<Pk>,
<Pk as MiniscriptKey>::Hash: PartialEq<<Pk as MiniscriptKey>::Hash>,
impl<Pk, Ctx> PartialOrd<Terminal<Pk, Ctx>> for Terminal<Pk, Ctx> where
Ctx: ScriptContext + PartialOrd<Ctx>,
Pk: MiniscriptKey + PartialOrd<Pk>,
<Pk as MiniscriptKey>::Hash: PartialOrd<<Pk as MiniscriptKey>::Hash>,
Ctx: ScriptContext + PartialOrd<Ctx>,
Pk: MiniscriptKey + PartialOrd<Pk>,
<Pk as MiniscriptKey>::Hash: PartialOrd<<Pk as MiniscriptKey>::Hash>,
fn partial_cmp(&self, other: &Terminal<Pk, Ctx>) -> Option<Ordering>
fn lt(&self, other: &Terminal<Pk, Ctx>) -> bool
fn le(&self, other: &Terminal<Pk, Ctx>) -> bool
fn gt(&self, other: &Terminal<Pk, Ctx>) -> bool
fn ge(&self, other: &Terminal<Pk, Ctx>) -> bool
impl<Pk, Ctx> StructuralEq for Terminal<Pk, Ctx> where
Ctx: ScriptContext,
Pk: MiniscriptKey,
Ctx: ScriptContext,
Pk: MiniscriptKey,
impl<Pk, Ctx> StructuralPartialEq for Terminal<Pk, Ctx> where
Ctx: ScriptContext,
Pk: MiniscriptKey,
Ctx: ScriptContext,
Pk: MiniscriptKey,
Auto Trait Implementations
impl<Pk, Ctx> RefUnwindSafe for Terminal<Pk, Ctx> where
Ctx: RefUnwindSafe,
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
Ctx: RefUnwindSafe,
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
impl<Pk, Ctx> Send for Terminal<Pk, Ctx> where
Ctx: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Ctx: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk, Ctx> Sync for Terminal<Pk, Ctx> where
Ctx: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Ctx: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk, Ctx> Unpin for Terminal<Pk, Ctx> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk, Ctx> UnwindSafe for Terminal<Pk, Ctx> where
Ctx: RefUnwindSafe,
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Ctx: RefUnwindSafe,
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[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.
fn to_owned(&self) -> T
[src]
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.
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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,