Skip to content

Script failing with ERR_NET_STAT: ERROR in getHighestBlock:string indices must be integers #1

@gasconleon

Description

@gasconleon

Hello.

Some times, the script fails with the indicated error.

We have noticed that Eth Netstats could give a non integer value for Best Block field over websocket and it makes the script to enter the exception on getHighestBlock function. We have included another try block that seems to solve the problem:

try:
    if (res_json['action']=='block'):
        if (int(res_json['data']['block']['number']) > highestBlock):
            highestBlock = int(res_json['data']['block']['number'])
            idx += 1
except Exception:
    time.sleep(0.5)
    pass # We could receive non integer value

I'm not an experienced developer and I don't know if this code is the best way to achieve a solution, but I hope that this helps to show the problem.

Best regards.

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