xport_reserve
Behaviour
Section titled “Behaviour”- Declares how many cross-chain exports this hook execution will perform.
- Must be called before any
xport()calls, similar to howetxn_reserve()must precedeemit(). - The valid count is
1or2. - Also reserves emitted-transaction capacity for the wrapper
Exporttransactions. - If the hook also uses
emit(), calletxn_reserve()beforexport_reserve(). - After
xport_reserve()sets the combined emitted-transaction reservation, a lateretxn_reserve()call fails withALREADY_SET.
Definition
Section titled “Definition”int64_t xport_reserve ( uint32_t count);Example
Section titled “Example”if (xport_reserve(1) < 0) rollback(SBUF("Export reserve failed"), 1);Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| count | uint32_t | The number of exports this hook execution will perform. Must be 1 or 2. |
Return Code
Section titled “Return Code”| Type | Description |
|---|---|
| int64_t | The reserved count on success. If negative, an error: ALREADY_SET — the Hook already called this function. TOO_SMALL — count is 0. TOO_BIG — count is greater than 2, or the combined existing emitted-transaction reservation and Export reservation would exceed 255. |