do not duplicate blacklist entries
This commit is contained in:
parent
5b20930d5c
commit
91c1e22324
@ -215,8 +215,11 @@ class OnionrCommunicatorDaemon:
|
|||||||
else:
|
else:
|
||||||
logger.warn('POW failed for block ' + blockHash)
|
logger.warn('POW failed for block ' + blockHash)
|
||||||
else:
|
else:
|
||||||
logger.warn('Metadata for ' + blockHash + ' is invalid.')
|
if self._core._blacklist.inBlacklist(realHash):
|
||||||
self._core._blacklist.addToDB(blockHash)
|
logger.warn('%s is blacklisted' % (realHash,))
|
||||||
|
else:
|
||||||
|
logger.warn('Metadata for ' + blockHash + ' is invalid.')
|
||||||
|
self._core._blacklist.addToDB(blockHash)
|
||||||
else:
|
else:
|
||||||
# if block didn't meet expected hash
|
# if block didn't meet expected hash
|
||||||
tempHash = self._core._crypto.sha3Hash(content) # lazy hack, TODO use var
|
tempHash = self._core._crypto.sha3Hash(content) # lazy hack, TODO use var
|
||||||
|
@ -95,6 +95,10 @@ class OnionrBlackList:
|
|||||||
'''
|
'''
|
||||||
# we hash the data so we can remove data entirely from our node's disk
|
# we hash the data so we can remove data entirely from our node's disk
|
||||||
hashed = self._core._utils.bytesToStr(self._core._crypto.sha3Hash(data))
|
hashed = self._core._utils.bytesToStr(self._core._crypto.sha3Hash(data))
|
||||||
|
|
||||||
|
if self.inBlacklist(hashed):
|
||||||
|
return
|
||||||
|
|
||||||
if not hashed.isalnum():
|
if not hashed.isalnum():
|
||||||
raise Exception("Hashed data is not alpha numeric")
|
raise Exception("Hashed data is not alpha numeric")
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user