Skip to content

Commit

Permalink
Correcting Height from str to int
Browse files Browse the repository at this point in the history
Clean up of urllib call for rpc
  • Loading branch information
sacherjj committed Jan 15, 2022
1 parent c93a6e0 commit 9e14a21
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resources/maintainer_scripts/node_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def _rpc_call(method: str, server: str, params: list, port: int = 7777, timeout:
req = request.Request(url, method="POST")
req.add_header('content-type', "application/json")
req.add_header('cache-control', "no-cache")
payload = json.dumps({"jsonrpc": "2.0", "method": method, "params": params, "id": 1}).encode()
r = request.urlopen(req, data=payload, timeout=timeout)
payload = json.dumps({"jsonrpc": "2.0", "method": method, "params": params, "id": 1}).encode('utf-8')
r = request.urlopen(req, payload, timeout=timeout)
json_data = json.loads(r.read())
return json_data["result"]

Expand All @@ -86,7 +86,7 @@ def _rpc_get_block(server: str, block_height=None, port: int = 7777, timeout: in
"""
params = []
if block_height:
params = [{"Height": block_height}]
params = [{"Height": int(block_height)}]
return NodeUtil._rpc_call("chain_get_block", server, params, port)

@staticmethod
Expand Down

0 comments on commit 9e14a21

Please sign in to comment.