Skip to main content

Spend

Struct Spend 

Source
pub struct Spend { /* private fields */ }
Expand description

The Spend struct represents a spend action and validates it by executing the unlocking and locking scripts.

Implementations§

Source§

impl Spend

Source

pub fn new(params: SpendParams) -> Self

Creates a new Spend validator from the given parameters.

Source

pub fn set_require_minimal(&mut self, require: bool)

Overrides MINIMALDATA enforcement (script-number and push minimality).

Default follows ts-sdk: enforced for version <= 1 transactions, relaxed for version > 1 (post-Genesis semantics).

Source

pub fn set_require_push_only(&mut self, require: bool)

Allows opting out of the push-only unlocking-script check.

The TypeScript @bsv/sdk Spend engine does not enforce push-only unlocking scripts; some OP_PUSH_TX-style covenant designs place executable code in the unlocking script and verify under that engine. Default remains true (enforced).

Source

pub fn reset(&mut self)

Resets the interpreter state for re-execution.

Source

pub fn validate(&mut self) -> Result<bool, ScriptEvaluationError>

Validates the spend by executing both scripts.

§Returns

Ok(true) if the spend is valid, or an error describing why validation failed.

Source

pub fn step(&mut self) -> Result<bool, ScriptEvaluationError>

Executes a single instruction (step).

§Returns

Ok(true) if execution should continue, Ok(false) if the script is complete.

Auto Trait Implementations§

§

impl !Freeze for Spend

§

impl !RefUnwindSafe for Spend

§

impl !Sync for Spend

§

impl Send for Spend

§

impl Unpin for Spend

§

impl UnsafeUnpin for Spend

§

impl UnwindSafe for Spend

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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