Skip to main content

TxScriptEngine

Struct TxScriptEngine 

Source
pub struct TxScriptEngine<'a, T: VerifiableTransaction, Reused: SigHashReusedValues> { /* private fields */ }

Implementations§

Source§

impl<'a, T: VerifiableTransaction, Reused: SigHashReusedValues> TxScriptEngine<'a, T, Reused>

Source

pub fn new(ctx: EngineContext<'a, Reused>, flags: EngineFlags) -> Self

Source

pub fn used_sig_ops(&self) -> u16

Returns the number of signature operations used in script execution.

Source

pub fn used_script_units(&self) -> ScriptUnits

Returns the total script units consumed so far.

Source

pub fn with_opcode_execution_log_buffer(self, buffer: &'a mut dyn Write) -> Self

Source

pub fn stacks(&self) -> ExecutionStacksView<'_>

Returns a read-only view of the execution stacks

Source

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 validated
  • input - The input being validated
  • input_idx - Index of the input in the transaction
  • utxo_entry - UTXO entry being spent
  • reused_values - Reused values for signature hashing
  • sig_cache - Cache for signature verification
  • kip10_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

Source

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

Source

pub fn from_script( script: &'a [u8], reused_values: &'a Reused, sig_cache: &'a Cache<SigCacheKey, bool>, flags: EngineFlags, ) -> Self

Source

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

Source

pub fn is_executing(&self) -> bool

Source

pub fn execute_opcode( &mut self, opcode: DynOpcodeImplementation<T, Reused>, ) -> Result<(), TxScriptError>

Source

pub fn execute(&mut self) -> Result<(), TxScriptError>

Source

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>

Source§

type Target = EngineContext<'a, Reused>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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>
where ScriptSource<'a, T>: Freeze, EngineContext<'a, Reused>: Freeze,

§

impl<'a, T, Reused> Unpin for TxScriptEngine<'a, T, Reused>
where ScriptSource<'a, T>: Unpin, EngineContext<'a, Reused>: Unpin,

§

impl<'a, T, Reused> UnsafeUnpin for TxScriptEngine<'a, T, Reused>
where ScriptSource<'a, T>: UnsafeUnpin, EngineContext<'a, Reused>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, U> ExactFrom<T> for U
where U: TryFrom<T>,

Source§

fn exact_from(value: T) -> U

Source§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

Source§

fn exact_into(self) -> U

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> OverflowingInto<U> for T
where U: OverflowingFrom<T>,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

Source§

fn wrapping_into(self) -> U