Skip to main content

decode_script

Function decode_script 

Source
pub fn decode_script(bytes: &[u8]) -> Result<Vec<ScriptChunk>, ScriptError>
Expand description

Decode raw script bytes into a vector of ScriptChunk values.

Handles OP_DATA_1..OP_DATA_75 (direct push), OP_PUSHDATA1/2/4 (extended push), and OP_RETURN (consumes remaining bytes as data unless inside a conditional block).

§Arguments

  • bytes - The raw script bytes to decode.

§Returns

A vector of parsed chunks, or a ScriptError if the data is truncated.