Skip to content

get_chain_head check if rpc_request is error before trying to parse. #182

@Arthurdw

Description

@Arthurdw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions