bug fixes and performence improvements

This commit is contained in:
Kevin Froman 2019-01-21 21:29:29 -06:00
parent 4d5e0aeb74
commit aef6d5d8e6
3 changed files with 16 additions and 8 deletions

View File

@ -218,7 +218,8 @@ class OnionrCommunicatorDaemon:
# if block does not exist on disk and is not already in block queue
if i not in self.blockQueue and not self._core._blacklist.inBlacklist(i):
if onionrproofs.hashMeetsDifficulty(i):
self.blockQueue.append(i) # add blocks to download queue
if len(self.blockQueue) <= 1000000:
self.blockQueue.append(i) # add blocks to download queue
self.decrementThreadCount('lookupBlocks')
return
@ -295,6 +296,8 @@ class OnionrCommunicatorDaemon:
if tempHash != 'ed55e34cb828232d6c14da0479709bfa10a0923dca2b380496e6b2ed4f7a0253':
# Dumb hack for 404 response from peer. Don't log it if 404 since its likely not malicious or a critical error.
logger.warn('Block hash validation failed for ' + blockHash + ' got ' + tempHash)
else:
removeFromQueue = False # Don't remove from queue if 404
if removeFromQueue:
try:
self.blockQueue.remove(blockHash) # remove from block queue both if success or false

View File

@ -207,22 +207,27 @@ class OnionrMail:
else:
# if -q or ctrl-c/d, exit function here, otherwise we successfully got the public key
return
logger.info('Enter your message, stop by entering -q on a new line.')
cancelEnter = False
logger.info('Enter your message, stop by entering -q on a new line. -c to cancel')
while newLine != '-q':
try:
newLine = input()
except (KeyboardInterrupt, EOFError):
pass
cancelEnter = True
if newLine == '-c':
cancelEnter = True
break
if newLine == '-q':
continue
newLine += '\n'
message += newLine
logger.info('Inserting encrypted message as Onionr block....')
if not cancelEnter:
logger.info('Inserting encrypted message as Onionr block....')
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True)
self.sentboxTools.addToSent(blockID, recip, message)
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True)
self.sentboxTools.addToSent(blockID, recip, message)
def menu(self):
choice = ''
while True:

View File

@ -79,7 +79,7 @@
"peers" : {
"minimum_score" : -100,
"max_stored_peers" : 5000,
"max_connect" : 50
"max_connect" : 1000
},
"timers" : {