sto_validate
Concepts
Section titled “Concepts”Behaviour
Section titled “Behaviour”- Parse an STObject pointed to by
read_ptr - Return 1 if the serialization is valid, 0 otherwise.
- The
blob(e.g. serialized transaction) is provided to be validated. - Returns number 1 if the STObject is valid, 0 if it isn’t, or an error code if validation fails.
Definition
Section titled “Definition”int64_t sto_validate ( uint32_t read_ptr, uint32_t read_len);function sto_validate(blob: ByteArray | HexString): ErrorCode | numberExample
Section titled “Example”int64_t result = sto_validate(tx_out, sizeof(tx_out));
if (tx_len <= 0) rollback("Invalid STO.", 12, 1);const result = sto_validate(tx_out)
if (result <= 0) rollback("Invalid STO.", 1)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| read_ptr | uint32_t | The buffer to read the source STObject from |
| read_len | uint32_t | The Length of the source object |
| Name | Type | Description |
|---|---|---|
| blob | ByteArray | HexString | The blob (e.g. serialized transaction) to be validated. |
Return Code
Section titled “Return Code”| Type | Description |
|---|---|
| int64_t |
|
| Type | Description |
|---|---|
| ErrorCode | number | Returns number 1 if the STObject is valid, 0 if it isn’t, or an error code if validation fails. |