From e17a9ee2c72666e250b3cfa5441e2a073e752d73 Mon Sep 17 00:00:00 2001 From: Shane Moore Date: Wed, 7 Dec 2016 00:25:43 -0800 Subject: [PATCH] Update RPC client for JSON rework and add missing arg in json_request_text Fixes #60 --- electrumx_rpc.py | 5 ++++- lib/jsonrpc.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/electrumx_rpc.py b/electrumx_rpc.py index 4535000..d6d1528 100755 --- a/electrumx_rpc.py +++ b/electrumx_rpc.py @@ -25,7 +25,10 @@ class RPCClient(JSONRPC): async def send_and_wait(self, method, params, timeout=None): # Raise incoming buffer size - presumably connection is trusted self.max_buffer_size = 5000000 - self.send_json_request(method, id_=method, params=params) + self.send_text(self.json_request_text(method, + id_=method, + params=params), + False) future = asyncio.ensure_future(self.messages.get()) for f in asyncio.as_completed([future], timeout=timeout): diff --git a/lib/jsonrpc.py b/lib/jsonrpc.py index 7b5b396..4f312bd 100644 --- a/lib/jsonrpc.py +++ b/lib/jsonrpc.py @@ -237,7 +237,7 @@ class JSONRPC(asyncio.Protocol, LoggedClass): def json_request_text(self, method, id_, params=None): '''Return the text of a JSON request.''' - return self.encode_payload(json_request_payload(method, params)) + return self.encode_payload(json_request_payload(method, id_, params)) def json_response_text(self, result, id_): '''Return the text of a JSON response.'''