commit bbc379c406af92ca6c5848343f862c1fbbecb5d3
parent 003e14213e3aa18e3db8b44b22495a22fdbfd9b6
Author: chris-belcher <chris-belcher@users.noreply.github.com>
Date: Mon, 18 May 2020 23:13:39 +0100
Handle no arguments in server.version from client
See issue #187
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/electrumpersonalserver/server/electrumprotocol.py b/electrumpersonalserver/server/electrumprotocol.py
@@ -462,12 +462,18 @@ class ElectrumProtocol(object):
elif method == "server.donation_address":
self._send_response(query, DONATION_ADDR)
elif method == "server.version":
- client_protocol_version = query["params"][1]
- if isinstance(client_protocol_version, list):
- client_min, client_max = float(client_min)
+ if len(query["params"]) > 0:
+ client_protocol_version = query["params"][1]
+ if isinstance(client_protocol_version, list):
+ client_min, client_max = float(client_min)
+ else:
+ client_min = float(query["params"][1])
+ client_max = client_min
else:
- client_min = float(query["params"][1])
- client_max = client_min
+ #it seems some clients like bluewallet dont provide a version
+ #just assume the client is compatible with us then
+ client_min = SERVER_PROTOCOL_VERSION_MIN
+ client_max = SERVER_PROTOCOL_VERSION_MAX
self.protocol_version = min(client_max, SERVER_PROTOCOL_VERSION_MAX)
if self.protocol_version < max(client_min,
SERVER_PROTOCOL_VERSION_MIN):