parity-bitcoin icon indicating copy to clipboard operation
parity-bitcoin copied to clipboard

id field of JSON-RPC response value is different from request value

Open zeroFruit opened this issue 4 years ago • 1 comments

I found that the id field of response value of JSON-RPC is different from id value of request.

Request

curl --request POST 'localhost:18332' \
--header 'Content-Type: application/json' \
--data-raw '{
	"id": "1",
	"jsonrpc": "2.0",
	"method": "getblockhash",
	"params": [1781013]
}'

Response

{
    "jsonrpc": "2.0",
    "result": "00000000b5b4d6d42163e5441fd1514a6f4f25523968090a2a5049a03efcd1f5",
    "id": 1
}

Problem

The value is same but type is different


FYI

  • req: "id": 1 ➡️ res: "id": 1 This works.
  • req: "id": "foo" ➡️ res: "id": "foo" This works

zeroFruit avatar Jul 18 '20 08:07 zeroFruit

Thank you for the report! This could be solved by simply updating jsonrpc references. But it isn't that simple now - we are too far beyond master oof a lot of crates + some crates are obsolete and we should switch to some others :/ As a workaround, you may use this branch - it fixes your problem. Me or someone else will try to look at updating dependencies at some point in the future.

svyatonik avatar Jul 21 '20 13:07 svyatonik