From ba1b154f52e37d29e2499b968b41e9bb33cacb48 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 10 Jul 2018 02:29:17 -0500 Subject: [PATCH] fixed bug where new communicator would download blocks it already has --- onionr/communicator2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/onionr/communicator2.py b/onionr/communicator2.py index 36001a96..3e173646 100755 --- a/onionr/communicator2.py +++ b/onionr/communicator2.py @@ -130,6 +130,7 @@ class OnionrCommunicatorDaemon: logger.info('LOOKING UP NEW BLOCKS') tryAmount = 2 newBlocks = '' + existingBlocks = self._core.getBlockList() for i in range(tryAmount): peer = self.pickOnlinePeer() # select random online peer newDBHash = self.peerAction(peer, 'getDBHash') # get their db hash @@ -143,7 +144,7 @@ class OnionrCommunicatorDaemon: for i in newBlocks.split('\n'): if self._core._utils.validateHash(i): # if newline seperated string is valid hash - if not os.path.exists('data/blocks/' + i + '.db'): + if not i in existingBlocks: # if block does not exist on disk and is not already in block queue if i not in self.blockQueue: self.blockQueue.append(i)