Consensys / Consensys/ethjsonrpc

Lib throws for the call `net_peerCount`

Open
#34 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
160
Forks
100
PR merge metrics
No merged PRs in 30d

Description

In my project, I use `testrpc` as the environment for my unit tests.
And `ehjsonrpc` throws for the call `net_peerCount` with this:
```
File "/../src/venv/lib/python3.5/site-packages/ethjsonrpc/client.py", line 175, in net_peerCount
return hex_to_dec(self._call('net_peerCount'))
File "/../src/venv/lib/python3.5/site-packages/ethjsonrpc/utils.py", line 10, in hex_to_dec
return int(x, 16)
TypeError: int() can't convert non-string with explicit base
```

I found a quick fix
https://github.com/ConsenSys/ethjsonrpc/blob/master/ethjsonrpc/utils.py#L8
```
def hex_to_dec(x):
if type(x) is int:
return x
return int(x, 16)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.