RPC getmininginfo error: integer out of range #8402

issue jlopp openend this issue on July 25, 2016
  1. jlopp commented at 1:11 am on July 25, 2016: contributor

    Just a guess, but I think that the new ‘currentblockweight’ data that is returned by this endpoint may be causing issues. When I call the endpoint against a recent build from master:

    0curl --user myrpcuser --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
    1Enter host password for user 'myrpcuser':
    2
    3{"result":null,"error":{"code":-1,"message":"JSON integer out of range"},"id":"curltest"}
    

    Similarly, “bitcoin-cli getmininginfo” returns:

    0error code: -1
    1error message:
    2JSON integer out of range
    
  2. jonasschnelli added the label Bug on Jul 25, 2016
  3. jonasschnelli added the label Priority Medium on Jul 25, 2016
  4. jonasschnelli added the label Mining on Jul 25, 2016
  5. laanwj commented at 12:24 pm on July 25, 2016: member
    An overflow error during generation of JSON instead of parsing? That’s odd.
  6. platedodev commented at 5:32 pm on July 30, 2016: none

    The master branch is regularly built and tested, but is not guaranteed to be completely stable. Tags are created regularly to indicate new official, stable release versions of Bitcoin Core.

  7. laanwj commented at 1:31 pm on August 4, 2016: member

    I’ve been unable to reproduce this:

    0$ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
    1Enter host password for user '__cookie__':
    2{"result":{"blocks":423636,"currentblocksize":0,"currentblockweight":0,"currentblocktx":0,"difficulty":201893210853.059,"errors":"This is a pre-release test build - use at your own risk - do not use for mining or merchant applications","networkhashps":1.506995848235919e+18,"pooledtx":13390,"testnet":false,"chain":"main"},"error":null,"id":"curltest"}
    

    Also I still don’t fully understand how this can happen. The error JSON integer out of range is raised in UniValue::get_int() and UniValue::get_int64(), neither of which is called in getmininginfo - as it has no arguments to parse.

    The only get_int() that is not part of a specific RPC command its input parsing is the one in JSONErrorReply. I suppose if something inside the call raises a JSONRPCError with an invalid “code” field, this could happen, it would be internally unable to parse its own error value. I don’t see where/how this could happen though.

  8. jlopp commented at 5:06 pm on August 4, 2016: contributor
    You’re right; it wasn’t a bug - it was a compatibility issue with my own code. I’ll be posting a related trivial documentation fix shortly.
  9. jlopp closed this on Aug 4, 2016

  10. DrahtBot locked this on Sep 8, 2021

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-09-14 07:12 UTC

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