rippled icon indicating copy to clipboard operation
rippled copied to clipboard

Rippled returns `success` when subscribing to invalid stream (Version: 1.9.1)

Open natenichols opened this issue 3 years ago • 1 comments

Issue Description

When subscribing to an account, rippled returns success when it should error with invalidParams.

Steps to Reproduce

{
  "id": "Example watch one account and all new ledgers",
  "command": "subscribe",
  "account": [
    "rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1"
  ]
}

Notice that the field is name account, not accounts.

Send this request to the testnet or devnet (not Clio) using https://xrpl.org/websocket-api-tool.html#subscribe.

Expected Result

I would expect an invalidParams error, as account (or accout or any misspelled variation of accounts) is not a valid stream. If rippled can't actually subscribe to any events, then it should respond to the client with an error.

Actual Result

  "id": "Example watch one account and all new ledgers",
  "result": {
    "warnings": [
      {
        "id": 1004,
        "message": "This is a reporting server.  The default behavior of a reporting server is to only return validated data. If you are looking for not yet validated data, include \"ledger_index : current\" in your request, which will cause this server to forward the request to a p2p node. If the forward is successful the response will include \"forwarded\" : \"true\""
      }
    ]
  },
  "status": "success",
  "type": "response"
}

That doesn't actually publish any transactions to the subscriber.

natenichols avatar Aug 10 '22 21:08 natenichols

A simple else if statement would fix this coding issue. If it is successful echo "Status" Else Echo "Reason" If there are more than 1 option for "Reason" then throw the "Reasons" variable into a loop!

If "id" = "id" echo "status" Else echo "response"

"id": "Example watch one account and all new ledgers", "result": { "warnings": [ { "id": 1004, "message": "This is a reporting server. The default behavior of a reporting server is to only return validated data. If you are looking for not yet validated data, include "ledger_index : current" in your request, which will cause this server to forward the request to a p2p node. If the forward is successful the response will include "forwarded" : "true"" } ] },

Else echo "type"

"status": "success", "type": "response" }

ncirelli87 avatar Aug 20 '22 03:08 ncirelli87