commit de80f68e4d76ac2ae16f63089535bb00334c64f5
parent 70b03cb92007743ffbe02399284075aa43a77b08
Author: SomberNight <somber.night@protonmail.com>
Date: Tue, 3 Nov 2020 20:45:31 +0100
interface: validate protocol-version negotiation on client-side too
related: https://github.com/romanz/electrs/issues/314
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -631,6 +631,9 @@ class Interface(Logger):
raise GracefulDisconnect(e) # probably 'unsupported protocol version'
if exit_early:
return
+ if ver[1] != version.PROTOCOL_VERSION:
+ raise GracefulDisconnect(f'server violated protocol-version-negotiation. '
+ f'we asked for {version.PROTOCOL_VERSION!r}, they sent {ver[1]!r}')
if not self.network.check_interface_against_healthy_spread_of_connected_servers(self):
raise GracefulDisconnect(f'too many connected servers already '
f'in bucket {self.bucket_based_on_ipaddress()}')