From 71e616df68a1680aec7d5fac811c196bed7dee5d Mon Sep 17 00:00:00 2001 From: EggPool Date: Fri, 29 Nov 2019 17:52:59 +0100 Subject: [PATCH] Properly handle peer dropping at bad time --- node.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/node.py b/node.py index fc44886..73f5dbb 100644 --- a/node.py +++ b/node.py @@ -11,7 +11,7 @@ # issues with db? perhaps you missed a commit() or two -VERSION = "4.4.0.8" # Post fork candidate 8 +VERSION = "4.4.0.9" # Post fork candidate 9 import functools import glob @@ -776,7 +776,10 @@ def handle(self): data = receive(self.request) # receive client's last block_hash # send all our followup hashes - + if data == "*": + # connection lost, no need to go on, that was banning the node like it forked. + node.logger.app_log.warning(f"Inbound: {peer_ip} dropped connection") + break node.logger.app_log.info(f"Inbound: Will seek the following block: {data}") client_block = db_handler_instance.block_height_from_hash(data)