pub struct ScriptEvaluationError {
pub message: String,
pub source_txid: String,
pub source_output_index: u32,
pub context: ExecutionContext,
pub program_counter: usize,
pub stack: Vec<Vec<u8>>,
pub alt_stack: Vec<Vec<u8>>,
pub if_stack: Vec<bool>,
pub stack_mem: usize,
pub alt_stack_mem: usize,
pub resource_limit: Option<ScriptResourceLimit>,
}Fields§
§message: StringThe error message describing what went wrong.
source_txid: StringThe TXID of the source UTXO being spent (hex, display order).
source_output_index: u32The output index of the source UTXO.
context: ExecutionContextWhether the error occurred in the unlocking or locking script.
program_counter: usizeThe program counter (chunk index) when the error occurred.
stack: Vec<Vec<u8>>The state of the main stack at the time of failure.
alt_stack: Vec<Vec<u8>>The state of the alt stack at the time of failure.
if_stack: Vec<bool>The state of the if/else condition stack.
stack_mem: usizeMemory usage of the main stack in bytes.
alt_stack_mem: usizeMemory usage of the alt stack in bytes.
resource_limit: Option<ScriptResourceLimit>Some when the evaluation stopped because a LOCAL resource budget was
exhausted (the TypeScript SDK throws a distinct
ScriptResourceLimitError for these); None for every verdict about
the script itself. Added in 0.3.23 (reference parity).
Implementations§
Source§impl ScriptEvaluationError
impl ScriptEvaluationError
Sourcepub fn new(
message: impl Into<String>,
source_txid: impl Into<String>,
source_output_index: u32,
context: ExecutionContext,
program_counter: usize,
stack: Vec<Vec<u8>>,
alt_stack: Vec<Vec<u8>>,
if_stack: Vec<bool>,
stack_mem: usize,
alt_stack_mem: usize,
) -> Self
pub fn new( message: impl Into<String>, source_txid: impl Into<String>, source_output_index: u32, context: ExecutionContext, program_counter: usize, stack: Vec<Vec<u8>>, alt_stack: Vec<Vec<u8>>, if_stack: Vec<bool>, stack_mem: usize, alt_stack_mem: usize, ) -> Self
Creates a new script evaluation error with the given context.
Sourcepub fn with_resource_limit(self, limit: ScriptResourceLimit) -> Self
pub fn with_resource_limit(self, limit: ScriptResourceLimit) -> Self
Mark this error as a LOCAL resource exhaustion (the reference’s
ScriptResourceLimitError): the evaluator’s budget, not the script’s
validity.
Sourcepub fn is_resource_limit(&self) -> bool
pub fn is_resource_limit(&self) -> bool
Whether the evaluation stopped on a LOCAL resource budget (see
ScriptEvaluationError::resource_limit) rather than on the script.
Trait Implementations§
Source§impl Clone for ScriptEvaluationError
impl Clone for ScriptEvaluationError
Source§fn clone(&self) -> ScriptEvaluationError
fn clone(&self) -> ScriptEvaluationError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScriptEvaluationError
impl Debug for ScriptEvaluationError
Source§impl Display for ScriptEvaluationError
impl Display for ScriptEvaluationError
Source§impl Error for ScriptEvaluationError
impl Error for ScriptEvaluationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()