electrum-personal-server

Maximally lightweight electrum server for a single user
git clone https://git.parazyd.org/electrum-personal-server
Log | Files | Refs | README

commit 7f633be0cfa62ed6e2efdcd4d419040c8ff8f6f4
parent 3e52ed9e11aab176fa2d8e8c619a9cae568424d4
Author: chris-belcher <chris-belcher@users.noreply.github.com>
Date:   Tue,  5 May 2020 21:56:58 +0100

Merge branch 'master' of https://github.com/chris-belcher/electrum-personal-server

Diffstat:
Melectrumpersonalserver/server/common.py | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/electrumpersonalserver/server/common.py b/electrumpersonalserver/server/common.py @@ -8,6 +8,7 @@ import logging import tempfile import platform import json +from json.decoder import JSONDecodeError from configparser import RawConfigParser, NoSectionError, NoOptionError from ipaddress import ip_network, ip_address @@ -132,12 +133,12 @@ def run_electrum_server(rpc, txmonitor, config): line = recv_buffer[:lb].rstrip() recv_buffer = recv_buffer[lb + 1:] lb = recv_buffer.find(b'\n') - line = line.decode("utf-8") - logger.debug("=> " + line) try: + line = line.decode("utf-8") query = json.loads(line) - except json.decoder.JSONDecodeError as e: + except (UnicodeDecodeError, JSONDecodeError) as e: raise IOError(repr(e)) + logger.debug("=> " + line) protocol.handle_query(query) except socket.timeout: on_heartbeat_connected(rpc, txmonitor, protocol)