added hash validation test and cleaned up output
This commit is contained in:
parent
15400432b1
commit
f39ab33517
@ -62,6 +62,7 @@ class API:
|
|||||||
bindPort = int(self.config['CLIENT']['PORT'])
|
bindPort = int(self.config['CLIENT']['PORT'])
|
||||||
self.bindPort = bindPort
|
self.bindPort = bindPort
|
||||||
self.clientToken = self.config['CLIENT']['CLIENT HMAC']
|
self.clientToken = self.config['CLIENT']['CLIENT HMAC']
|
||||||
|
if not os.environ.get("WERKZEUG_RUN_MAIN") == "true":
|
||||||
logger.debug('Your HMAC token: ' + logger.colors.underline + self.clientToken)
|
logger.debug('Your HMAC token: ' + logger.colors.underline + self.clientToken)
|
||||||
|
|
||||||
if not debug and not self._developmentMode:
|
if not debug and not self._developmentMode:
|
||||||
@ -174,7 +175,7 @@ class API:
|
|||||||
return resp
|
return resp
|
||||||
if not os.environ.get("WERKZEUG_RUN_MAIN") == "true":
|
if not os.environ.get("WERKZEUG_RUN_MAIN") == "true":
|
||||||
logger.info('Starting client on ' + self.host + ':' + str(bindPort) + '...')
|
logger.info('Starting client on ' + self.host + ':' + str(bindPort) + '...')
|
||||||
logger.debug('Client token: ' + logger.colors.underline + self.clientToken)
|
#logger.debug('Client token: ' + logger.colors.underline + self.clientToken)
|
||||||
|
|
||||||
app.run(host=self.host, port=bindPort, debug=True, threaded=True)
|
app.run(host=self.host, port=bindPort, debug=True, threaded=True)
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class OnionrCommunicate:
|
|||||||
blockProcessTimer = 0
|
blockProcessTimer = 0
|
||||||
blockProcessAmount = 5
|
blockProcessAmount = 5
|
||||||
heartBeatTimer = 0
|
heartBeatTimer = 0
|
||||||
heartBeatRate = 10
|
heartBeatRate = 100
|
||||||
logger.debug('Communicator debugging enabled.')
|
logger.debug('Communicator debugging enabled.')
|
||||||
torID = open('data/hs/hostname').read()
|
torID = open('data/hs/hostname').read()
|
||||||
|
|
||||||
@ -87,7 +87,8 @@ class OnionrCommunicate:
|
|||||||
blocks += self.performGet('getBlockHashes', i)
|
blocks += self.performGet('getBlockHashes', i)
|
||||||
if self._utils.validateHash(currentDB):
|
if self._utils.validateHash(currentDB):
|
||||||
self._core.setPeerInfo(i, "blockDBHash", currentDB)
|
self._core.setPeerInfo(i, "blockDBHash", currentDB)
|
||||||
logger.debug('BLOCKS: \n' + blocks)
|
if len(blocks.strip()) != 0:
|
||||||
|
logger.debug('BLOCKS:' + blocks)
|
||||||
blockList = blocks.split('\n')
|
blockList = blocks.split('\n')
|
||||||
for i in blockList:
|
for i in blockList:
|
||||||
if len(i.strip()) == 0:
|
if len(i.strip()) == 0:
|
||||||
|
@ -106,4 +106,14 @@ class OnionrTests(unittest.TestCase):
|
|||||||
if myCore.daemonQueue() == False:
|
if myCore.daemonQueue() == False:
|
||||||
logger.info('Succesfully added and read command')
|
logger.info('Succesfully added and read command')
|
||||||
|
|
||||||
|
def testHashValidation(self):
|
||||||
|
logger.debug('--------------------------')
|
||||||
|
logger.info('Running hash validation test...')
|
||||||
|
import core
|
||||||
|
myCore = core.Core()
|
||||||
|
if not myCore._utils.validateHash("$324dfgfdg") and myCore._utils.validateHash("f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2") and not myCore._utils.validateHash("f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd$"):
|
||||||
|
self.assertTrue(True)
|
||||||
|
else:
|
||||||
|
self.assertTrue(False)
|
||||||
|
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user