From 7acb695acd753798381acba831e7d5c89d69d546 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sun, 28 Jan 2018 16:45:22 -0600 Subject: [PATCH] added hash validation warning for blocks --- onionr/communicator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/onionr/communicator.py b/onionr/communicator.py index 65cb13b8..16a44b80 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -137,9 +137,11 @@ class OnionrCommunicate: if data == False or len(data) > 10000000: continue hasher.update(data.encode()) - if hasher.hexdigest() == hash: + if hasher.hexdigest() == hash.strip(): self._core.setData(data) logger.info('Successfully obtained data for ' + hash) + else: + logger.warn("Failed to validate " + hash) def performGet(self, action, peer, data=None, type='tor'): '''Performs a request to a peer through Tor or i2p (currently only tor)'''