pub trait StackCtxOperations: Sized {
// Required methods
fn check_item_eq(self, idx: u32, target: &[u8]) -> Self;
fn check_item_pref(self, idx: u32, pref: &[u8]) -> Self;
}
Expand description
Additional operations required on Script for supporting Miniscript fragments that have access to a global context
Required Methods§
Sourcefn check_item_eq(self, idx: u32, target: &[u8]) -> Self
fn check_item_eq(self, idx: u32, target: &[u8]) -> Self
pick an element indexed from the bottom of the stack. This cannot check whether the idx is within stack limits. Copies the element at index idx to the top of the stack Checks item equality against the specified target
Sourcefn check_item_pref(self, idx: u32, pref: &[u8]) -> Self
fn check_item_pref(self, idx: u32, pref: &[u8]) -> Self
Since, there is a policy restriction that initial pushes must be only 80 bytes, we need user to provide suffix in separate items There can be atmost 7 cats, because the script element must be less than 520 bytes total in order to compute an hash256 on it. Even if the witness does not require 7 pushes, the user should push 7 elements with possibly empty values.
Copies the script item at position and compare the hash256 with it
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.