opentensor/async-substrate-interface

`get_chain_head` check if `rpc_request` is error before trying to parse.

Closed this issue · 1 comments

The code runs:

self.last_block_hash = result["rpc_request"][0]["result"]

But the actual result can be:

{
  "rpc_request": [
    {
      "error": {
        "code": "-32999",
        "message": "'RPC rate limit exceeded'"
      },
      "id": "wP878",
      "jsonrpc": "2.0"
    }
  ]
}

Which causes an unexpected KeyError "result" which can be confusing.

Fixed in #193 will be released in 1.5.6 next week or so