XRPL-Labs / xrpld-hooks

ISC License
94 stars 28 forks source link

otxn_id call returns 'Malformed transaction' error #14

Closed technotip closed 1 year ago

technotip commented 3 years ago

Issue Description

otxn_id Mismatched function type.

Expected: params{i32 , i32} returns{i64} , Got: params{i32 , i32 , i32} returns{i64}

Steps to Reproduce

    {
        uint8_t txn_id[32];
        int64_t bytes_written =  otxn_id(SBUF(txn_id));

        if(bytes_written != 32)
                rollback(SBUF("Testcase: Couldn't fetch transaction hash."), 100);

        trace_num(SBUF("Testcase: bytest written"), bytes_written);
        trace(SBUF("Testcase: txn_id"), SBUF(txn_id), 1);
    }

Expected Result

Output the canonical hash of the originating transaction.

Actual Result

[RippledError(Submit failed, { resultCode: 'temMALFORMED',
  resultMessage: 'Malformed transaction.',
  engine_result: 'temMALFORMED',
  engine_result_code: -299,
  engine_result_message: 'Malformed transaction.',

Log output

instantiation failed: incompatible import type, Code: 0x61    
Mismatched function type. Expected: params{i32 , i32} returns{i64} , Got: params{i32 , i32 , i32} returns{i64}    
When linking module: "env" , function name: "otxn_id"    At AST node: import description    At AST node: import section    At AST node: module2021-May-17 12:11:17.817176635 UTC View:WRN HookError[rE21UaiJwe2MHFM5iKz2AXVsoRpve4bz1-rE21UaiJwe2MHFM5iKz2AXVsoRpve4bz1]: SSVM error 97
RichardAH commented 1 year ago

This API was changed to take a flags parameter some time back, the documentation has been updated now https://xrpl-hooks.readme.io/reference/otxn_id