From 40ea61707f39731fafd0cee501a1c8d0cdfead76 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 16 Aug 2018 23:21:21 -0500 Subject: [PATCH] do not try to download already saved blocks from upload --- Makefile | 2 +- onionr/communicator2.py | 4 ++++ onionr/static-data/default_config.json | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c51fc72b..b872b042 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ test: soft-reset: @echo "Soft-resetting Onionr..." - rm -f onionr/data/blocks/*.dat onionr/data/*.db | true > /dev/null 2>&1 + rm -f onionr/data/blocks/*.dat onionr/data/*.db onionr/data/block-nonces.dat | true > /dev/null 2>&1 @./RUN-LINUX.sh version | grep -v "Failed" --color=always reset: diff --git a/onionr/communicator2.py b/onionr/communicator2.py index 1f2166ac..42be9e45 100755 --- a/onionr/communicator2.py +++ b/onionr/communicator2.py @@ -186,6 +186,10 @@ class OnionrCommunicatorDaemon: if blockHash in self.currentDownloading: logger.debug('ALREADY DOWNLOADING ' + blockHash) continue + if blockHash in self._core.getBlockList(): + logger.debug('%s is already saved' % (blockHash,)) + self.blockQueue.remove(blockHash) + continue self.currentDownloading.append(blockHash) logger.info("Attempting to download %s..." % blockHash) peerUsed = self.pickOnlinePeer() diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json index c298c137..fcbf733e 100644 --- a/onionr/static-data/default_config.json +++ b/onionr/static-data/default_config.json @@ -57,8 +57,8 @@ "blockCacheTotal": 50000000 }, "peers":{ - "minimumScore": -1000, - "maxStoredPeers": 100, - "maxConnect": 3 + "minimumScore": -100, + "maxStoredPeers": 500, + "maxConnect": 5 } }