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

2021-05-3 - Breaking API and behaviour changes

Hooks testnet build 0a1cb3f175414a5a7bb1b6b4c4646c04

API Changes

  • emit now takes a write_ptr and write_len parameter pair at the start of the paramaters. This must be at least 32 bytes and will be populated with the canonical hash of the emitted transaction.
  • hook and cbak now take a uint32_t as the sole parameter. In cbak this is 1 when the emitted txn has failed to be accepted before sfLastLedgerSeq when 0 the emitted txn was accepted.

Behaviour Changes

  • Emitted transactions that are successfully passed to emit but subsequently fail to be incorporated into a ledger before sfLastLedgerSequence expires are now cleaned up by a ttEMIT_FAILURE pseudotransaction.
  • ttEMIT_FAILURE also triggers cbak(1) on the emitting hook. Note the previously reserved parameter to callback is now used to signal that an emitted transaction failed. 0 = success 1 = failure.
  • Maximum number of emitted transactions in a chain of emitted transactions (i.e. where one emitted txn emits another txn) is now 10.
  • sfLastLedgerSeq for emitted transactions must be 5 more than the current ledger.