diff --git a/libs/client.py b/libs/client.py index d4650c1..5a87197 100644 --- a/libs/client.py +++ b/libs/client.py @@ -1,4 +1,3 @@ class Client: def __init__(self): - self.banned = False self.connected = False \ No newline at end of file diff --git a/node.py b/node.py index ddc6fad..8a18b2c 100644 --- a/node.py +++ b/node.py @@ -590,7 +590,6 @@ def handle(self): node.plugin_manager.execute_filter_hook('peer_ip', dict_ip) if node.peers.is_banned(peer_ip) or dict_ip['ip'] == 'banned': - client_instance.banned = True self.request.close() node.logger.app_log.info(f"IP {peer_ip} banned, disconnected") @@ -606,7 +605,7 @@ def handle(self): timeout_operation = 120 # timeout timer_operation = time.time() # start counting - while not client_instance.banned and node.peers.version_allowed(peer_ip, node.version_allow) and client_instance.connected: + while not node.peers.is_banned(host) and node.peers.version_allowed(peer_ip, node.version_allow) and client_instance.connected: try: # Failsafe if self.request == -1: diff --git a/worker.py b/worker.py index 13f62d4..7bb1b59 100644 --- a/worker.py +++ b/worker.py @@ -50,7 +50,6 @@ def worker(host, port, node): client_instance_worker = client.Client() if node.peers.is_banned(host) or dict_ip['ip'] == 'banned': - client_instance_worker.banned = True node.logger.app_log.warning(f"IP {host} is banned, won't connect") return @@ -106,10 +105,10 @@ def worker(host, port, node): node.logger.app_log.info(f"Connected to {this_client}") node.logger.app_log.info(f"Current active pool: {node.peers.connection_pool}") - if not client_instance_worker.banned and node.peers.version_allowed(host, node.version_allow) and not node.IS_STOPPING: + if not node.peers.is_banned(host) and node.peers.version_allowed(host, node.version_allow) and not node.IS_STOPPING: db_handler_instance = dbhandler.DbHandler(node.index_db, node.ledger_path, node.hyper_path, node.ram, node.ledger_ram_file, logger) - while not client_instance_worker.banned and node.peers.version_allowed(host, node.version_allow) and not node.IS_STOPPING: + while not node.peers.is_banned(host) and node.peers.version_allowed(host, node.version_allow) and not node.IS_STOPPING: try: #ensure_good_peer_version(host) @@ -169,7 +168,6 @@ def worker(host, port, node): send(s, data) else: - node.logger.app_log.warning( f"Outbound: Node is at block {client_block}") # now check if we have any newer @@ -276,7 +274,6 @@ def worker(host, port, node): except: if node.peers.warning(s, peer_ip, "Failed to deliver the longest chain", 2): raise ValueError(f"{peer_ip} is banned") - else: digest_block(node, segments, s, peer_ip, db_handler_instance)