@@ -99,13 +99,13 @@ async def send_request(self, method, args=()):
99
99
self ._concurrency .release ()
100
100
101
101
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
103
103
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
105
105
)
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 )
109
109
110
110
async def keepalive_loop (self , timeout = 3 , max_idle = 60 ):
111
111
try :
@@ -149,8 +149,11 @@ def connection_lost(self, exc):
149
149
150
150
class Network :
151
151
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__
154
157
155
158
def __init__ (self , ledger ):
156
159
self .ledger = ledger
0 commit comments