class_addressGenerator quality fixes

This commit is contained in:
lakshyacis 2019-11-04 20:15:18 +05:30
parent 77b8b5aa42
commit e534994ee3
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
1 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,6 @@
"""
A thread for creating addresses
"""
import time import time
import hashlib import hashlib
from binascii import hexlify from binascii import hexlify
@ -18,6 +20,7 @@ from network import StoppableThread
class addressGenerator(StoppableThread): class addressGenerator(StoppableThread):
"""A thread for creating addresses"""
name = "addressGenerator" name = "addressGenerator"
@ -33,6 +36,7 @@ class addressGenerator(StoppableThread):
Process the requests for addresses generation Process the requests for addresses generation
from `.queues.addressGeneratorQueue` from `.queues.addressGeneratorQueue`
""" """
# pylint: disable=too-many-locals, too-many-branches, protected-access, too-many-statements
while state.shutdown == 0: while state.shutdown == 0:
queueValue = queues.addressGeneratorQueue.get() queueValue = queues.addressGeneratorQueue.get()
nonceTrialsPerByte = 0 nonceTrialsPerByte = 0
@ -212,7 +216,7 @@ class addressGenerator(StoppableThread):
elif command == 'createDeterministicAddresses' \ elif command == 'createDeterministicAddresses' \
or command == 'getDeterministicAddress' \ or command == 'getDeterministicAddress' \
or command == 'createChan' or command == 'joinChan': or command == 'createChan' or command == 'joinChan':
if len(deterministicPassphrase) == 0: if not deterministicPassphrase:
self.logger.warning( self.logger.warning(
'You are creating deterministic' 'You are creating deterministic'
' address(es) using a blank passphrase.' ' address(es) using a blank passphrase.'
@ -361,7 +365,7 @@ class addressGenerator(StoppableThread):
address) address)
shared.myECCryptorObjects[ripe] = \ shared.myECCryptorObjects[ripe] = \
highlevelcrypto.makeCryptor( highlevelcrypto.makeCryptor(
hexlify(potentialPrivEncryptionKey)) hexlify(potentialPrivEncryptionKey))
shared.myAddressesByHash[ripe] = address shared.myAddressesByHash[ripe] = address
tag = hashlib.sha512(hashlib.sha512( tag = hashlib.sha512(hashlib.sha512(
encodeVarint(addressVersionNumber) + encodeVarint(addressVersionNumber) +