From b2a7292d21e713f24d9aee68a6d56689818edea6 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Wed, 24 Mar 2021 14:54:36 +0200 Subject: [PATCH] Sudden KeyError in addKnownNode() --- src/network/knownnodes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/knownnodes.py b/src/network/knownnodes.py index a17fae58..e6d2f290 100644 --- a/src/network/knownnodes.py +++ b/src/network/knownnodes.py @@ -161,7 +161,10 @@ def addKnownNode(stream, peer, lastseen=None, is_self=False): if stream == prev['stream']: if lastseen - prev['lastseen'] > 3600 * 24: # more than a day ago, this should be port change - del knownNodes[stream][Peer(peer.host, prev['port'])] + try: + del knownNodes[stream][Peer(peer.host, prev['port'])] + except KeyError: + pass outages[peer.host]['port'] = peer.port else: rating = -0.2