decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
740 stars 291 forks source link

batch request issues (json 2.0) #1029

Closed TrantorRWS closed 6 years ago

TrantorRWS commented 6 years ago

I just tried to compile latest dcrd code that should support batch request. PR https://github.com/decred/dcrd/pull/841 I tested to run a pool with NOMP but it failed when a request with no parameter is send to daemon:

[{"jsonrpc":"1.0","result":{"isvalid":true,"address":"xxxxxxxxxx"},"error":null,"id":1518626515519},
{"jsonrpc":"1.0","result":99988625.9504296,"error":null,"id":1518626515529},
{"jsonrpc":"1.0","result":{"version":1010200,"protocolversion":4,"blocks":212907,"timeoffset":0,"connections":8,"proxy":"","difficulty":99988625.9504296,"testnet":false,"relayfee":0.001,"errors":""},"error":null,"id":1518626515525},
{"jsonrpc":"1.0","result":{"blocks":212907,"currentblocksize":4755,"currentblocktx":14,"difficulty":99988625.9504296,"stakedifficulty":8022382166,"errors":"","generate":false,"genproclimit":1,"hashespersec":0,"networkhashps":1427757029648934,"pooledtx":63,"testnet":false},"error":null,"id":1518626515526},
{"jsonrpc":"1.0","result":null,"error":{"code":-8,"message":"Failed to parse request: wrong number of params (expected between 1 and 2, received 0)"},"id":1518626515523}]

It seems that you pointed this issue here : https://github.com/decred/dcrd/pull/841#issuecomment-361356019

Tested in mainnet and testnet with two different version of NOMP

dnldd commented 6 years ago

Looks like the rpc you called requires at least a param"error":{"code":-8,"message":"Failed to parse request: wrong number of params (expected between 1 and 2, received 0)"}. Provide the rpc that failed, thanks.

TrantorRWS commented 6 years ago

The only information about batch RPC request I can find in the sourcee code is:

        var batchRpcCalls = [
            ['validateaddress', [options.address]],
            ['getdifficulty', []],
            ['getinfo', []],
            ['getmininginfo', []],
            ['submitblock', []]
];

If I try to send submit block with dcrctl I got:

./dcrctl -j submitblock
submitblock command: wrong number of params (expected between 1 and 2, received 0) (code: ErrNumParams)
Usage:
  submitblock "hexblock" ({"workid":"value"})
dnldd commented 6 years ago

the rpc documentation should have what you need https://github.com/decred/dcrd/blob/master/docs/json_rpc_api.md

davecgh commented 6 years ago

I'm going to close this as it does not appear to be a bug with dcrd, rather an issue in how it's being called.