use var instead of direct call in hash comparison in block sync

master
Kevin Froman 2018-07-10 02:15:55 -05:00
parent 2c70531a51
commit e0618f3166
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
1 changed files with 6 additions and 1 deletions

View File

@ -161,7 +161,12 @@ class OnionrCommunicatorDaemon:
except AttributeError: except AttributeError:
pass pass
content = base64.b64decode(content) # content is base64 encoded in transport content = base64.b64decode(content) # content is base64 encoded in transport
if self._core._crypto.sha3Hash(content) == blockHash: realHash = self._core._crypto.sha3Hash(content)
try:
realHash = realHash.decode() # bytes on some versions for some reason
except AttributeError:
pass
if realHash == blockHash:
content = content.decode() # decode here because sha3Hash needs bytes above content = content.decode() # decode here because sha3Hash needs bytes above
metas = self._core._utils.getBlockMetadataFromData(content) # returns tuple(metadata, meta), meta is also in metadata metas = self._core._utils.getBlockMetadataFromData(content) # returns tuple(metadata, meta), meta is also in metadata
metadata = metas[0] metadata = metas[0]