pub struct Code(pub Vec<u8>);Expand description
Serialized script, used inside transaction inputs and outputs
Tuple Fields§
§0: Vec<u8>Implementations§
Source§impl Code
impl Code
Sourcepub fn annotate(&self, flags: &Flags) -> Vec<Result<Opcode, Vec<Error>>>
pub fn annotate(&self, flags: &Flags) -> Vec<Result<Opcode, Vec<Error>>>
Returns a script annotated with errors that could occur during evaluation.
Sourcepub fn to_component(&self) -> Result<Component<PossiblyBad>, Error>
pub fn to_component(&self) -> Result<Component<PossiblyBad>, Error>
Convert this into a Component, which can then be combined in authored scripts in Script.
Sourcepub fn serialize(script: &[Opcode]) -> Vec<u8> ⓘ
pub fn serialize(script: &[Opcode]) -> Vec<u8> ⓘ
Convert a sequence of Opcodes to the bytes that would be included in a transaction.
Sourcepub fn sig_op_count(&self, accurate: bool) -> u32
pub fn sig_op_count(&self, accurate: bool) -> u32
Pre-version-0.6, Bitcoin always counted CHECKMULTISIGs as 20 sigops. With pay-to-script-hash, that changed: CHECKMULTISIGs serialized in script_sigs are counted more accurately, assuming they are of the form … OP_N CHECKMULTISIG …
Sourcepub fn is_unspendable(&self) -> bool
pub fn is_unspendable(&self) -> bool
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack.
The only purpose of this function is to reproduce the behavior of the
zcashd function IsUnspendable(), which is used for “asm” encoding
and dust transaction filtering.
https://github.com/zcash/zcash/blob/2352fbc1ed650ac4369006bea11f7f20ee046b84/src/script/script.h#L617-L620
Trait Implementations§
Source§impl Evaluable for Code
impl Evaluable for Code
Source§fn to_bytes(&self) -> Vec<u8> ⓘ
fn to_bytes(&self) -> Vec<u8> ⓘ
Convert a sequence of Opcodes to the bytes that would be included in a transaction.
Source§fn is_pay_to_script_hash(&self) -> bool
fn is_pay_to_script_hash(&self) -> bool
Returns true iff this script is P2SH.
Source§fn is_push_only(&self) -> bool
fn is_push_only(&self) -> bool
Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical).