Compute the canonical hash of the slotted object and return it

Behaviour

  • Compute the canonical hash of the object currently occupying the specified slot
  • Write the hash to the output buffer

Definition

int64_t slot_id (
    uint32_t write_ptr,
    uint32_t write_len,
    uint32_t slot_no
);

Example

uint8_t txn_id[32];
int64_t bytes_written = 
    slot_id(txn_id, 32, 1); // assumes a txn is slotted into slot=1

Parameters

Name

Type

Description

write_ptr

uint32_t

Pointer to a buffer of to store the ID.

write_len

uint32_t

Length of the output buffer. Should be at least 32 bytes.

slot_no

uint32_t

The slot number

Return Code

Type

Description

int64_t

The number of bytes written

If negative, an error:
OUT_OF_BOUNDS

  • pointers/lengths specified outside of hook memory.

TOO_SMALL

  • output buffer was not large enough to hold the serialized object