From 8498143783cb98dca28d80a4e3dc4ef997538e4b Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 1 Feb 2018 22:58:04 +0100 Subject: [PATCH] Download fixes - check if already have object before requesting --- src/network/downloadthread.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/network/downloadthread.py b/src/network/downloadthread.py index f3beb77c..6da5b838 100644 --- a/src/network/downloadthread.py +++ b/src/network/downloadthread.py @@ -5,6 +5,7 @@ import time import addresses from debug import logger from helper_threading import StoppableThread +from inventory import Inventory from network.connectionpool import BMConnectionPool import protocol from state import missingObjects @@ -53,6 +54,9 @@ class DownloadThread(threading.Thread, StoppableThread): payload = bytearray() payload.extend(addresses.encodeVarint(len(request))) for chunk in request: + if chunk in Inventory(): + del i.objectsNewToMe[chunk] + continue payload.extend(chunk) missingObjects[chunk] = now i.append_write_buf(protocol.CreatePacket('getdata', payload))