pub struct TxScriptEngine<'a, T: VerifiableTransaction, Reused: SigHashReusedValues> { /* private fields */ }Implementations§
Source§impl<'a, T: VerifiableTransaction, Reused: SigHashReusedValues> TxScriptEngine<'a, T, Reused>
impl<'a, T: VerifiableTransaction, Reused: SigHashReusedValues> TxScriptEngine<'a, T, Reused>
pub fn new(ctx: EngineContext<'a, Reused>, flags: EngineFlags) -> Self
Sourcepub fn used_sig_ops(&self) -> u16
pub fn used_sig_ops(&self) -> u16
Returns the number of signature operations used in script execution.
Sourcepub fn used_script_units(&self) -> ScriptUnits
pub fn used_script_units(&self) -> ScriptUnits
Returns the total script units consumed so far.
pub fn with_opcode_execution_log_buffer(self, buffer: &'a mut dyn Write) -> Self
Sourcepub fn stacks(&self) -> ExecutionStacksView<'_>
pub fn stacks(&self) -> ExecutionStacksView<'_>
Returns a read-only view of the execution stacks
Sourcepub fn from_transaction_input(
tx: &'a T,
input: &'a TransactionInput,
input_idx: usize,
utxo_entry: &'a UtxoEntry,
ctx: EngineContext<'a, Reused>,
flags: EngineFlags,
) -> Self
pub fn from_transaction_input( tx: &'a T, input: &'a TransactionInput, input_idx: usize, utxo_entry: &'a UtxoEntry, ctx: EngineContext<'a, Reused>, flags: EngineFlags, ) -> Self
Creates a new Script Engine for validating transaction input.
§Arguments
tx- The transaction being validatedinput- The input being validatedinput_idx- Index of the input in the transactionutxo_entry- UTXO entry being spentreused_values- Reused values for signature hashingsig_cache- Cache for signature verificationkip10_enabled- Whether KIP-10 transaction introspection opcodes are enabled
§Panics
- When input_idx >= number of inputs in transaction (malformed input)
§Returns
Script engine instance configured for the given input
pub fn from_transaction_input_with_script_units_limit( tx: &'a T, input: &'a TransactionInput, input_idx: usize, utxo_entry: &'a UtxoEntry, ctx: EngineContext<'a, Reused>, flags: EngineFlags, script_units_limit: ScriptUnits, ) -> Self
pub fn from_script( script: &'a [u8], reused_values: &'a Reused, sig_cache: &'a Cache<SigCacheKey, bool>, flags: EngineFlags, ) -> Self
pub fn from_script_with_script_units_limit( script: &'a [u8], reused_values: &'a Reused, sig_cache: &'a Cache<SigCacheKey, bool>, script_units_limit: ScriptUnits, flags: EngineFlags, ) -> Self
pub fn is_executing(&self) -> bool
pub fn execute_opcode( &mut self, opcode: DynOpcodeImplementation<T, Reused>, ) -> Result<(), TxScriptError>
pub fn execute(&mut self) -> Result<(), TxScriptError>
Sourcepub fn execute_and_return_stacks(self) -> Result<ExecutionStacks, TxScriptError>
pub fn execute_and_return_stacks(self) -> Result<ExecutionStacks, TxScriptError>
Executes the scripts without the final error condition checks and returns both stacks in raw vector form.
Trait Implementations§
Source§impl<'a, T: VerifiableTransaction, Reused: SigHashReusedValues> Deref for TxScriptEngine<'a, T, Reused>
impl<'a, T: VerifiableTransaction, Reused: SigHashReusedValues> Deref for TxScriptEngine<'a, T, Reused>
Auto Trait Implementations§
impl<'a, T, Reused> !RefUnwindSafe for TxScriptEngine<'a, T, Reused>
impl<'a, T, Reused> !Send for TxScriptEngine<'a, T, Reused>
impl<'a, T, Reused> !Sync for TxScriptEngine<'a, T, Reused>
impl<'a, T, Reused> !UnwindSafe for TxScriptEngine<'a, T, Reused>
impl<'a, T, Reused> Freeze for TxScriptEngine<'a, T, Reused>
impl<'a, T, Reused> Unpin for TxScriptEngine<'a, T, Reused>
impl<'a, T, Reused> UnsafeUnpin for TxScriptEngine<'a, T, Reused>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more