Each bit in this unsigned 64-bit integer indicates whether the Hook should execute on a particular transaction type. All bits are active low except bit 22 which is active high. Since 22 is ttHOOK_SET this means the default value of all 0's will not fire on a SetHook transaction but will fire on every other transaction type. This is a deliberate design choice to help people avoid bricking their XRPL account with a misbehaving hook.
Bits are numbered from right to left:
- bit 0 - right most, i.e. the least significant bit.
- bit 63 - the left-most, i.e. the most significant bit.
- If we want to completely disable the hook:
~(1ULL << 22) /* every bit is 1 except bit 22 which is 0 */
- If we want to disable the hook on everything except ttPAYMENT:
~(1ULL << 22) & ~(1ULL)
- If we want to enable the hook on everything except ttHOOK_SET
- If we want to enable hook firing on ttHOOK_SET (dangerous) and every other transaction type:
(1ULL << 22)
Updated 8 months ago