Discussions
SetHook with field HookHash "xrpl-hooks" issue?
Hi.
below seems to be an issue about "hookDefinition sharing" feature as documented here:
https://xrpl-hooks.readme.io/docs/sethook-transaction#install-operation
https://xrpl-hooks.readme.io/docs/reference-counting
So
To make all easier, I wasm compiled the tiny "starter.c" with no parameters.
- using HookBuilder (or my environment) I defined a "SetHook" transaction to account (A) as below
txn hash: "9BA7315CDE3D50A0DDC88EB4A3E41A0E2FA886A8B11061AA16D4D531E183E4FF"
...omiss....
Fee: "10000000",
Flags: 0,
Hooks: [
{
Hook: {
CreateCode: "0061736D01000000011C0460057F7F7F7F7F017E60037F7F7E017E60027F7F017F60017F017E02230303656E76057472616365000003656E7606616363657074000103656E76025F670002030201030503010002062B077F0141C088040B7F004180080B7F0041BA080B7F004180080B7F0041C088040B7F0041000B7F0041010B07080104686F6F6B00030AC4800001C0800001017F230041106B220124002001200036020C419C08411D418008411C410010001A410022002000420010011A41012200200010021A200141106A240042000B0B4001004180080B39537461727465722E633A2043616C6C65642C205061706572696E6F0022537461727465722E633A2043616C6C65642C205061706572696E6F22",
Flags: 1,
HookApiVersion: 0,
HookNamespace: "A0800997EB2FED3F3B33D86DE629F548449450ECF40530106224132D616061BE",
HookOn: "3FF5BE"
}
}
]
...omiss....
- using only my environment I defined a second "SetHook" transaction to account (B) as below,
just by referring the same hook by its hash
txn hash: N.D.
...omiss....
Fee: "10000000",
Flags: 0,
Hooks: [
{
Hook: {
HookHash: "A8DDA006B1DA5008CE6FC7C8E6C9A93F08CEA24DA1F2AD8ED03274E3FFB93D59",
Flags: 1,
HookApiVersion: 0,
HookNamespace: "A0800997EB2FED3F3B33D86DE629F548449450ECF40530106224132D616061BE",
HookOn: "3FF5BE"
}
}
]
...omiss....
I simply am using something like this js call
const txnResponse = await xclient.submitAndWait(txnBlob);
and "npm update" to all the latest packages including:
"dependencies": {
"xrpl-hooks": "^2.2.1"
}
I don't know much more about, but I suspect the problem is in the client-side "xrpl-hooks".
It seems it simply doesn't handle a transaction with field "HookHash" and without "CreateCode"