This PR fixes several broken RPCExamples from the “blockchain” category:
HelpExampleCli
forwaitforblock
(disturbing comma between arguments)HelpExampleCli
forwaitforblockheight
(disturbing comma between arguments)HelpExampleRpc
forwaitforblockheight
(disturbing quotation marks around integer argument)
Note that the CLI example for waitforblockheight
would also work with the first argument in quotation marks (in contrast to the RPC example), but I removed them as well as they are not needed.
Outputs for the non-working examples in the master branch:
0$ ./bitcoin-cli waitforblock "0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862", 1000
1error code: -8
2error message:
3blockhash must be of length 64 (not 65, for '0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862,')
0$ ./bitcoin-cli waitforblockheight "100", 1000
1error: Error parsing JSON:100,
0$ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "waitforblockheight", "params": ["100", 1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
1Enter host password for user '__cookie__':
2{"result":null,"error":{"code":-1,"message":"JSON value is not an integer as expected"},"id":"curltest"}
Outputs for the fixed examples in the PR branch:
0$ ./bitcoin-cli waitforblock "0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862" 1000
1{
2 "hash": "0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080",
3 "height": 622416
4}
0$ ./bitcoin-cli waitforblockheight 100 1000
1{
2 "hash": "0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080",
3 "height": 622416
4}
0$ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "waitforblockheight", "params": [100, 1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
1Enter host password for user '__cookie__':
2{"result":{"hash":"0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080","height":622416},"error":null,"id":"curltest"}