fixed key pow verification
This commit is contained in:
parent
d02af9600a
commit
03eb98fd16
@ -132,6 +132,8 @@ class OnionrCommunicate:
|
|||||||
elif command[0] == 'runCheck':
|
elif command[0] == 'runCheck':
|
||||||
logger.info('Status check; looks good.')
|
logger.info('Status check; looks good.')
|
||||||
open('data/.runcheck', 'w+').close()
|
open('data/.runcheck', 'w+').close()
|
||||||
|
elif command[0] == 'kex':
|
||||||
|
self.pexCount = pexTimer - 1
|
||||||
elif command[0] == 'event':
|
elif command[0] == 'event':
|
||||||
# todo
|
# todo
|
||||||
pass
|
pass
|
||||||
|
@ -79,8 +79,6 @@ class Core:
|
|||||||
def addPeer(self, peerID, powID, name=''):
|
def addPeer(self, peerID, powID, name=''):
|
||||||
'''
|
'''
|
||||||
Adds a public key to the key database (misleading function name)
|
Adds a public key to the key database (misleading function name)
|
||||||
|
|
||||||
DOES NO SAFETY CHECKS if the ID is valid, but prepares the insertion
|
|
||||||
'''
|
'''
|
||||||
# This function simply adds a peer to the DB
|
# This function simply adds a peer to the DB
|
||||||
if not self._utils.validatePubKey(peerID):
|
if not self._utils.validatePubKey(peerID):
|
||||||
@ -452,7 +450,7 @@ class Core:
|
|||||||
try:
|
try:
|
||||||
if len(i[0]) != 0:
|
if len(i[0]) != 0:
|
||||||
if getPow:
|
if getPow:
|
||||||
peerList.append(i[0] + '-' + i[11])
|
peerList.append(i[0] + '-' + i[1])
|
||||||
else:
|
else:
|
||||||
peerList.append(i[0])
|
peerList.append(i[0])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
@ -461,7 +459,6 @@ class Core:
|
|||||||
try:
|
try:
|
||||||
peerList.append(self._crypto.pubKey + '-' + self._crypto.pubKeyPowToken)
|
peerList.append(self._crypto.pubKey + '-' + self._crypto.pubKeyPowToken)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print('what')
|
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
peerList.append(self._crypto.pubKey)
|
peerList.append(self._crypto.pubKey)
|
||||||
|
@ -109,11 +109,17 @@ class OnionrUtils:
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
logger.warn('No pow token')
|
logger.warn('No pow token')
|
||||||
continue
|
continue
|
||||||
if self._core._crypto.blake2bHash(base64.b64decode(key[1]) + key[0].encode()).startswith('0000'):
|
powHash = self._core._crypto.blake2bHash(base64.b64decode(key[1]) + self._core._crypto.blake2bHash(key[0].encode()))
|
||||||
|
try:
|
||||||
|
powHash = powHash.encode()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
if powHash.startswith(b'0000'):
|
||||||
if not key[0] in self._core.listPeers(randomOrder=False) and type(key) != None and key[0] != self._core._crypto.pubKey:
|
if not key[0] in self._core.listPeers(randomOrder=False) and type(key) != None and key[0] != self._core._crypto.pubKey:
|
||||||
if self._core.addPeer(key[0], key[1]):
|
if self._core.addPeer(key[0], key[1]):
|
||||||
retVal = True
|
retVal = True
|
||||||
else:
|
else:
|
||||||
|
logger.warn(powHash)
|
||||||
logger.warn('%s pow failed' % key[0])
|
logger.warn('%s pow failed' % key[0])
|
||||||
return retVal
|
return retVal
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
Loading…
Reference in New Issue
Block a user