fixed wrong var used for peer causing crash
This commit is contained in:
parent
c249a42bb7
commit
acd5494979
@ -83,7 +83,7 @@ class OnionrCommunicate:
|
||||
if highFailureTimer == highFailureRate:
|
||||
highFailureTimer = 0
|
||||
for i in self.peerData:
|
||||
if self.peerData[i]['failCount'] == self.highFailureAmount:
|
||||
if self.peerData[i]['failCount'] >= self.highFailureAmount:
|
||||
self.peerData[i]['failCount'] -= 1
|
||||
if pexTimer == pexCount:
|
||||
self.getNewPeers()
|
||||
@ -204,7 +204,7 @@ class OnionrCommunicate:
|
||||
blocks += self.performGet('getBlockHashes', i)
|
||||
except TypeError:
|
||||
logger.warn('Failed to get data hash from ' + i)
|
||||
self.peerData[peer]['failCount'] -= 1
|
||||
self.peerData[i]['failCount'] -= 1
|
||||
if self._utils.validateHash(currentDB):
|
||||
self._core.setAddressInfo(i, "DBHash", currentDB)
|
||||
if len(blocks.strip()) != 0:
|
||||
|
@ -595,6 +595,11 @@ class Core:
|
||||
'''
|
||||
retData = ''
|
||||
metadata = '-' + header + '-'
|
||||
metadata = metadata.encode()
|
||||
try:
|
||||
data.decode()
|
||||
except AttributeError:
|
||||
data = data.encode()
|
||||
if len(data) == 0:
|
||||
logger.error('Will not insert empty block')
|
||||
else:
|
||||
|
@ -572,13 +572,13 @@ class Onionr:
|
||||
newFile = sys.argv[2]
|
||||
logger.info('Attempting to add file...')
|
||||
try:
|
||||
with open(newFile, 'r') as new:
|
||||
with open(newFile, 'rb') as new:
|
||||
new = new.read()
|
||||
except FileNotFoundError:
|
||||
logger.warn('That file does not exist. Improper path?')
|
||||
else:
|
||||
logger.debug(new)
|
||||
self.onionrCore.insertBlock(new, header='bin')
|
||||
logger.info(self.onionrCore.insertBlock(new, header='bin'))
|
||||
|
||||
|
||||
Onionr()
|
||||
|
Loading…
Reference in New Issue
Block a user