added hash validation warning for blocks

master
Kevin Froman 2018-01-28 16:45:22 -06:00
parent 1b0d575575
commit 7acb695acd
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
1 changed files with 3 additions and 1 deletions

View File

@ -137,9 +137,11 @@ class OnionrCommunicate:
if data == False or len(data) > 10000000: if data == False or len(data) > 10000000:
continue continue
hasher.update(data.encode()) hasher.update(data.encode())
if hasher.hexdigest() == hash: if hasher.hexdigest() == hash.strip():
self._core.setData(data) self._core.setData(data)
logger.info('Successfully obtained data for ' + hash) logger.info('Successfully obtained data for ' + hash)
else:
logger.warn("Failed to validate " + hash)
def performGet(self, action, peer, data=None, type='tor'): def performGet(self, action, peer, data=None, type='tor'):
'''Performs a request to a peer through Tor or i2p (currently only tor)''' '''Performs a request to a peer through Tor or i2p (currently only tor)'''