From 17d1b9e340b9d9203d73b4bf86d9b829bc0e02bd Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 1 Mar 2018 03:20:57 -0600 Subject: [PATCH] work on pex --- onionr/communicator.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/onionr/communicator.py b/onionr/communicator.py index d1bc9ef4..56d3bbd8 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -33,14 +33,7 @@ class OnionrCommunicate: self._utils = onionrutils.OnionrUtils(self._core) self._crypto = onionrcrypto.OnionrCrypto(self._core) logger.info('Starting Bitcoin Node... with Tor socks port:' + str(sys.argv[2])) - #while True: - #try: self.bitcoin = btc.OnionrBTC(torP=int(sys.argv[2])) - #except: - # ugly but needed - # pass - #else: - # break logger.info('Bitcoin Node started, on block: ' + self.bitcoin.node.getBlockHash(self.bitcoin.node.getLastBlockHeight())) blockProcessTimer = 0 blockProcessAmount = 5 @@ -60,6 +53,9 @@ class OnionrCommunicate: # Process blocks based on a timer blockProcessTimer += 1 heartBeatTimer += 1 + pexCount += 1 + if pexTimer == pexCount: + self.getNewPeers() if heartBeatRate == heartBeatTimer: logger.debug('Communicator heartbeat') heartBeatTimer = 0 @@ -75,7 +71,13 @@ class OnionrCommunicate: time.sleep(1) return - + + def getNewPeers(self): + ''' + Get new peers + ''' + return + def lookupBlocks(self): ''' Lookup blocks and merge new ones