These docs are for v2.0. Click to read the latest docs for v3.0.

Validate an STObject

Concepts

Behaviour

  • Parse an STObject pointed to by read_ptr
  • Return 1 if the serialization is valid, 0 otherwise.

Definition

int64_t sto_validate (
    uint32_t read_ptr,
    uint32_t read_len
);

Example

int64_t result = 
  sto_validate(tx_out, sizeof(tx_out));

if (tx_len <= 0)
    rollback("Invalid STO.", 12, 1);

Parameters

NameTypeDescription
read_ptruint32_tThe buffer to read the source STObject from
read_lenuint32_tThe Length of the source object

Return Code

TypeDescription
int64_t1 if the STObject pointed to by read_ptr is a valid STObject.
0 if it isn't.

If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.