rippled icon indicating copy to clipboard operation
rippled copied to clipboard

[noripple_check] Remove `transactions` array from error response (Version: develop)

Open godexsoft opened this issue 2 years ago • 1 comments

Issue Description

Handler of noripple_check produces empty transactions array on error response. This is probably unintended? There are also extra fields ledger_index and ledger_hash which should not be there according to the doc. However it was decided to adjust the doc for those instead. See this issue.

I suggest we remove the insertion of the empty transactions array in error response.

Steps to Reproduce

Send a request like

{ "method": "noripple_check", "params": [ { "account": "r7x8JFCExiWopq7YuhK8AXjLhZe4fQ5e",
 "ledger_index":"validated", "role": "gateway", "transactions": true } ] }

Expected Result

{ "result": { "error": "actMalformed", "error_code": 35, "error_message": "Account malformed.",
 "request": { "account": "r7x8JFCExiWopq7YuhK8AXjLhZe4fQ5e", "command": "noripple_check",
 "ledger_index": "validated", "role": "gateway", "transactions": true }, "status": "error",
 "validated": true } }

Actual Result

{ "result": { "error": "actMalformed", "error_code": 35, "error_message": "Account malformed.",
 "ledger_hash": "AEEF7A04B2F0448307CD4F94877CB326A86C56838ED42E67CC15F6F74B578453",
 "ledger_index": 29089522, "request": { "account": "r7x8JFCExiWopq7YuhK8AXjLhZe4fQ5e",
 "command": "noripple_check", "ledger_index": "validated", "role": "gateway",
 "transactions": true }, "status": "error", "transactions": [], "validated": true } }

Environment

Any

godexsoft avatar Jul 11 '23 12:07 godexsoft

I formatted the JSON blocks to be a little more readable.

This can probably most easily be accomplished by reordering the code in the handler function to initialize transactions after the account ID is parsed.

ximinez avatar Jul 11 '23 14:07 ximinez