RPC getmininginfo error: integer out of range #8402

issue jlopp opened 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:

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

    Similarly, "bitcoin-cli getmininginfo" returns:

    error code: -1
    error message:
    JSON 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:

    $ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
    Enter host password for user '__cookie__':
    {"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
Labels

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: 2026-05-01 18:15 UTC

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