Cleanup and fixes

This commit is contained in:
Kevin 2018-12-13 04:35:01 +00:00
parent c0bfe102d5
commit 993e5ae4c7
4 changed files with 26 additions and 41 deletions

View file

@ -49,9 +49,14 @@ class DaemonTools:
data = {'node': ourID}
combinedNodes = ourID + peer
existingRand = self.daemon._core.getAddressInfo(peer, 'powValue')
if type(existingRand) is type(None):
existingRand = ''
if peer in self.announceCache:
data['random'] = self.announceCache[peer]
elif len(existingRand) > 0:
data['random'] = existingRand
else:
proof = onionrproofs.DataPOW(combinedNodes, forceDifficulty=4)
try:
@ -68,6 +73,7 @@ class DaemonTools:
logger.info('Successfully introduced node to ' + peer)
retData = True
self.daemon._core.setAddressInfo(peer, 'introduced', 1)
self.daemon._core.setAddressInfo(peer, 'powValue', data['random'])
self.daemon.decrementThreadCount('announceNode')
return retData
@ -152,8 +158,8 @@ class DaemonTools:
self.daemon.decrementThreadCount('cooldownPeer')
def runCheck(self):
if os.path.isfile('data/.runcheck'):
os.remove('data/.runcheck')
if os.path.isfile(self.daemon._core.dataDir + '.runcheck'):
os.remove(self.daemon._core.dataDir + '.runcheck')
return True
return False