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