rpc: fix broken RPCExamples for waitforblock(height) #18398

pull theStack wants to merge 1 commits into bitcoin:master from theStack:20200321-rpc-fix-broken-rpcexamples-for-waitforblock-height changing 1 files +3 −3
  1. theStack commented at 3:02 pm on March 21, 2020: member

    This PR fixes several broken RPCExamples from the “blockchain” category:

    • HelpExampleCli for waitforblock (disturbing comma between arguments)
    • HelpExampleCli for waitforblockheight (disturbing comma between arguments)
    • HelpExampleRpc for waitforblockheight (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"}
    
  2. rpc: fix broken RPCExamples for waitforblock(height)
    Fixes the following RPCExamples:
    -> ExampleCli waitforblock (removed comma between arguments)
    -> ExampleCli waitforblockheight (removed comma between arguments)
    -> ExampleRpc waitforblockheight (removed quotation marks around integer argument)
    ef35604c9c
  3. laanwj added the label RPC/REST/ZMQ on Mar 21, 2020
  4. fanquake approved
  5. fanquake commented at 8:22 am on March 25, 2020: member

    ACK ef35604c9c88e7800e9be106b791b1c0fa8b310a

    master:

    0src/bitcoin-cli waitforblock "0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862", 1000
    1error code: -8
    2error message:
    3blockhash must be of length 64 (not 65, for '0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862,')
    4
    5src/bitcoin-cli waitforblockheight "100", 1000
    6error: Error parsing JSON:100,
    

    PR:

     0src/bitcoin-cli waitforblock "0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862" 1000
     1{
     2  "hash": "000000000000000000047fb670bd469bfcaa15fc8085c6befbda345b5348a167",
     3  "height": 622876
     4}
     5
     6src/bitcoin-cli waitforblockheight 100 1000
     7{
     8  "hash": "000000000000000000047fb670bd469bfcaa15fc8085c6befbda345b5348a167",
     9  "height": 622876
    10}
    
  6. fanquake merged this on Mar 27, 2020
  7. fanquake closed this on Mar 27, 2020

  8. theStack deleted the branch on Dec 1, 2020
  9. Fabcien referenced this in commit 466d6dbef8 on Jan 13, 2021
  10. MarcoFalke referenced this in commit dd097c42df on Sep 2, 2021
  11. sidhujag referenced this in commit 5ce8996590 on Sep 4, 2021
  12. PastaPastaPasta referenced this in commit cd1010708b on Dec 22, 2021
  13. PastaPastaPasta referenced this in commit 273ae664c1 on Dec 22, 2021
  14. PastaPastaPasta referenced this in commit 3d2fee0794 on Dec 22, 2021
  15. PastaPastaPasta referenced this in commit e99f1ee057 on Dec 28, 2021
  16. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me