tnetwork: disconnect from server on malformed header subs - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 75a85a81616a660b8932d0bbc3e3c2842cdc6532 DIR parent 8b1051fa24ff7f2c85b66a6012581f0287bbb827 HTML Author: SomberNight <somber.night@protonmail.com> Date: Tue, 3 Jul 2018 17:17:20 +0200 network: disconnect from server on malformed header subs closes #4478 Diffstat: M lib/network.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- DIR diff --git a/lib/network.py b/lib/network.py t@@ -1065,7 +1065,12 @@ class Network(util.DaemonThread): self.on_stop() def on_notify_header(self, interface, header_dict): - header_hex, height = header_dict['hex'], header_dict['height'] + try: + header_hex, height = header_dict['hex'], header_dict['height'] + except KeyError: + # no point in keeping this connection without headers sub + self.connection_down(interface.server) + return header = blockchain.deserialize_header(util.bfh(header_hex), height) if height < self.max_checkpoint(): self.connection_down(interface.server)