Skip to content

Commit a471dcb

Browse files
committed
Fix checking protocol version
1 parent eb5da95 commit a471dcb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lbry/wallet/network.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ async def send_request(self, method, args=()):
9999
self._concurrency.release()
100100

101101
async def ensure_server_version(self, required=None, timeout=3):
102-
required = required or self.network.PROTOCOL_VERSION
102+
required = required or self.network.PROTOCOL_MAX_VERSION
103103
response = await asyncio.wait_for(
104-
self.send_request('server.version', [__version__, required]), timeout=timeout
104+
self.send_request('server.version', [self.network.CLIENT_NAME, required]), timeout=timeout
105105
)
106-
if tuple(int(piece) for piece in response[0].split(".")) < self.network.MINIMUM_REQUIRED:
107-
raise IncompatibleWalletServerError(*self.server)
108-
return response
106+
if tuple(int(piece) for piece in response[1].split(".")) >= self.network.PROTOCOL_MIN_VERSION:
107+
return response
108+
raise IncompatibleWalletServerError(*self.server)
109109

110110
async def keepalive_loop(self, timeout=3, max_idle=60):
111111
try:
@@ -149,8 +149,11 @@ def connection_lost(self, exc):
149149

150150
class Network:
151151

152-
PROTOCOL_VERSION = __version__
153-
MINIMUM_REQUIRED = (0, 65, 0)
152+
CLIENT_VERSION = __version__
153+
CLIENT_NAME = "LBRY SDK " + CLIENT_VERSION
154+
155+
PROTOCOL_MIN_VERSION = (0, 65, 0)
156+
PROTOCOL_MAX_VERSION = __version__
154157

155158
def __init__(self, ledger):
156159
self.ledger = ledger

0 commit comments

Comments
 (0)