Fixed addressGenerator deterministicPassphrase encode issue
This commit is contained in:
parent
afb3a22f99
commit
74d043bd21
|
@ -54,21 +54,6 @@ 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
|
|
||||||
# pylint: disable=protected-access, too-many-statements
|
|
||||||
# logger.info('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
|
|
||||||
# logger.info('inside the class_addressGenerator\n')
|
|
||||||
# logger.info('current thread -{}'.format(threading.current_thread().name))
|
|
||||||
# logger.info('&&&&&&&&&&&&&&&&&&&&&&&')
|
|
||||||
# logger.info('MMMMMMMMMMMMMMMMM33333333333333333333333333')
|
|
||||||
# logger.info(
|
|
||||||
# 'queues.addressGeneratorQueue.queue -{}'.format(
|
|
||||||
# queues.addressGeneratorQueue.queue
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
# logger.info('state.shutdown-{}'.format(state.shutdown))
|
|
||||||
# logger.info('MMMMMMMMMMMMMMMMM33333333333333333333333333')
|
|
||||||
# state.shutdown = 0
|
|
||||||
logger.error('addressGenerator addressGenerator')
|
logger.error('addressGenerator addressGenerator')
|
||||||
logger.error('state.shutdown-{}'.format(state.shutdown))
|
logger.error('state.shutdown-{}'.format(state.shutdown))
|
||||||
logger.error('--------self----{}'.format(self))
|
logger.error('--------self----{}'.format(self))
|
||||||
|
@ -97,8 +82,11 @@ class addressGenerator(StoppableThread):
|
||||||
'OOOOOOOOOOOOOOOOOOOOOOOOOOOOO')
|
'OOOOOOOOOOOOOOOOOOOOOOOOOOOOO')
|
||||||
command, addressVersionNumber, streamNumber, label, \
|
command, addressVersionNumber, streamNumber, label, \
|
||||||
deterministicPassphrase, live = queueValue
|
deterministicPassphrase, live = queueValue
|
||||||
|
logger.error('++++++++++++100++++++++++++')
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
|
logger.error('++++++++++++102++++++++++++')
|
||||||
numberOfAddressesToMake = 1
|
numberOfAddressesToMake = 1
|
||||||
|
logger.error('++++++++++++104++++++++++++')
|
||||||
numberOfNullBytesDemandedOnFrontOfRipeHash = 1
|
numberOfNullBytesDemandedOnFrontOfRipeHash = 1
|
||||||
elif queueValue[0] == 'joinChan':
|
elif queueValue[0] == 'joinChan':
|
||||||
logger.info(
|
logger.info(
|
||||||
|
@ -164,20 +152,25 @@ class addressGenerator(StoppableThread):
|
||||||
' one version %s address which it cannot do.\n',
|
' one version %s address which it cannot do.\n',
|
||||||
addressVersionNumber)
|
addressVersionNumber)
|
||||||
if nonceTrialsPerByte == 0:
|
if nonceTrialsPerByte == 0:
|
||||||
|
logger.error('++++++++++++170++++++++++++')
|
||||||
nonceTrialsPerByte = BMConfigParser().getint(
|
nonceTrialsPerByte = BMConfigParser().getint(
|
||||||
'bitmessagesettings', 'defaultnoncetrialsperbyte')
|
'bitmessagesettings', 'defaultnoncetrialsperbyte')
|
||||||
if nonceTrialsPerByte < \
|
if nonceTrialsPerByte < \
|
||||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte:
|
defaults.networkDefaultProofOfWorkNonceTrialsPerByte:
|
||||||
|
logger.error('++++++++++++175++++++++++++')
|
||||||
nonceTrialsPerByte = \
|
nonceTrialsPerByte = \
|
||||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte
|
defaults.networkDefaultProofOfWorkNonceTrialsPerByte
|
||||||
if payloadLengthExtraBytes == 0:
|
if payloadLengthExtraBytes == 0:
|
||||||
|
logger.error('++++++++++++179++++++++++++')
|
||||||
payloadLengthExtraBytes = BMConfigParser().getint(
|
payloadLengthExtraBytes = BMConfigParser().getint(
|
||||||
'bitmessagesettings', 'defaultpayloadlengthextrabytes')
|
'bitmessagesettings', 'defaultpayloadlengthextrabytes')
|
||||||
if payloadLengthExtraBytes < \
|
if payloadLengthExtraBytes < \
|
||||||
defaults.networkDefaultPayloadLengthExtraBytes:
|
defaults.networkDefaultPayloadLengthExtraBytes:
|
||||||
|
logger.error('++++++++++++184++++++++++++')
|
||||||
payloadLengthExtraBytes = \
|
payloadLengthExtraBytes = \
|
||||||
defaults.networkDefaultPayloadLengthExtraBytes
|
defaults.networkDefaultPayloadLengthExtraBytes
|
||||||
if command == 'createRandomAddress':
|
if command == 'createRandomAddress':
|
||||||
|
logger.error('++++++++++++188++++++++++++')
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateStatusBar', ""
|
'updateStatusBar', ""
|
||||||
))
|
))
|
||||||
|
@ -194,9 +187,9 @@ class addressGenerator(StoppableThread):
|
||||||
potentialPrivSigningKey = OpenSSL.rand(32)
|
potentialPrivSigningKey = OpenSSL.rand(32)
|
||||||
potentialPubSigningKey = highlevelcrypto.pointMult(
|
potentialPubSigningKey = highlevelcrypto.pointMult(
|
||||||
potentialPrivSigningKey)
|
potentialPrivSigningKey)
|
||||||
logger.info('&&&&&&&&&&&&&&&&&&&&&&&')
|
logger.error('&&&&&&&&&&&&&&&&&&&&&&&')
|
||||||
logger.info('---------157--------------')
|
logger.error('---------157--------------')
|
||||||
logger.info('&&&&&&&&&&&&&&&&&&&&&&&\n')
|
logger.error('&&&&&&&&&&&&&&&&&&&&&&&\n')
|
||||||
while True:
|
while True:
|
||||||
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix += 1
|
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix += 1
|
||||||
potentialPrivEncryptionKey = OpenSSL.rand(32)
|
potentialPrivEncryptionKey = OpenSSL.rand(32)
|
||||||
|
@ -211,10 +204,10 @@ class addressGenerator(StoppableThread):
|
||||||
'\x00'.encode('utf-8') * numberOfNullBytesDemandedOnFrontOfRipeHash
|
'\x00'.encode('utf-8') * numberOfNullBytesDemandedOnFrontOfRipeHash
|
||||||
):
|
):
|
||||||
break
|
break
|
||||||
logger.info('&&&&&&&&&&&&&&&&&&&&&&&')
|
logger.error('&&&&&&&&&&&&&&&&&&&&&&&')
|
||||||
logger.info('---------174--------------')
|
logger.error('---------174--------------')
|
||||||
logger.info('&&&&&&&&&&&&&&&&&&&&&&&\n')
|
logger.error('&&&&&&&&&&&&&&&&&&&&&&&\n')
|
||||||
self.logger.info(
|
self.logger.error(
|
||||||
'Generated address with ripe digest: %s', hexlify(ripe))
|
'Generated address with ripe digest: %s', hexlify(ripe))
|
||||||
try:
|
try:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
|
@ -228,9 +221,9 @@ class addressGenerator(StoppableThread):
|
||||||
# The user must have a pretty fast computer.
|
# The user must have a pretty fast computer.
|
||||||
# time.time() - startTime equaled zero.
|
# time.time() - startTime equaled zero.
|
||||||
pass
|
pass
|
||||||
logger.info('&&&&&&&&&&&&&&&&&&&&&&&')
|
logger.error('&&&&&&&&&&&&&&&&&&&&&&&')
|
||||||
logger.info('---------191--------------')
|
logger.error('---------191--------------')
|
||||||
logger.info('&&&&&&&&&&&&&&&&&&&&&&&\n')
|
logger.error('&&&&&&&&&&&&&&&&&&&&&&&\n')
|
||||||
address = encodeAddress(
|
address = encodeAddress(
|
||||||
addressVersionNumber, streamNumber, ripe)
|
addressVersionNumber, streamNumber, ripe)
|
||||||
|
|
||||||
|
@ -375,6 +368,7 @@ class addressGenerator(StoppableThread):
|
||||||
'getDeterministicAddress',
|
'getDeterministicAddress',
|
||||||
'createChan',
|
'createChan',
|
||||||
'joinChan'):
|
'joinChan'):
|
||||||
|
logger.error('++++++++++++++387+++++++++++')
|
||||||
if not deterministicPassphrase:
|
if not deterministicPassphrase:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
'You are creating deterministic'
|
'You are creating deterministic'
|
||||||
|
@ -388,12 +382,14 @@ class addressGenerator(StoppableThread):
|
||||||
"Generating %1 new addresses."
|
"Generating %1 new addresses."
|
||||||
).arg(str(numberOfAddressesToMake))
|
).arg(str(numberOfAddressesToMake))
|
||||||
))
|
))
|
||||||
|
logger.error('++++++++++401++++++++++++++')
|
||||||
signingKeyNonce = 0
|
signingKeyNonce = 0
|
||||||
encryptionKeyNonce = 1
|
encryptionKeyNonce = 1
|
||||||
# We fill out this list no matter what although we only
|
# We fill out this list no matter what although we only
|
||||||
# need it if we end up passing the info to the API.
|
# need it if we end up passing the info to the API.
|
||||||
|
logger.error('++++++++++406++++++++++++++')
|
||||||
listOfNewAddressesToSendOutThroughTheAPI = []
|
listOfNewAddressesToSendOutThroughTheAPI = []
|
||||||
logger
|
logger.error('++++++++++409++++++++++++++')
|
||||||
for _ in range(numberOfAddressesToMake):
|
for _ in range(numberOfAddressesToMake):
|
||||||
# This next section is a little bit strange. We're
|
# This next section is a little bit strange. We're
|
||||||
# going to generate keys over and over until we find
|
# going to generate keys over and over until we find
|
||||||
|
@ -401,37 +397,63 @@ class addressGenerator(StoppableThread):
|
||||||
# \x00 or \x00\x00. Then when we pack them into a
|
# \x00 or \x00\x00. Then when we pack them into a
|
||||||
# Bitmessage address, we won't store the \x00 or
|
# Bitmessage address, we won't store the \x00 or
|
||||||
# \x00\x00 bytes thus making the address shorter.
|
# \x00\x00 bytes thus making the address shorter.
|
||||||
|
logger.error('++++++++++416++++++++++++++')
|
||||||
startTime = time.time()
|
startTime = time.time()
|
||||||
|
logger.error('++++++++++418++++++++++++++')
|
||||||
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix = 0
|
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix = 0
|
||||||
while True:
|
while True:
|
||||||
|
logger.error('++++++++++421++++++++++++++')
|
||||||
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix += 1
|
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix += 1
|
||||||
|
logger.error('++++++++++423++++++++++++++')
|
||||||
|
logger.error('signingKeyNonce 424 -{}+++++++'.format(
|
||||||
|
signingKeyNonce
|
||||||
|
))
|
||||||
|
logger.error('encodeVarint(signingKeyNonce) 427 -{}+'.format(
|
||||||
|
encodeVarint(signingKeyNonce)
|
||||||
|
))
|
||||||
|
logger.error('deterministicPassphrase 427 -{}+'.format(
|
||||||
|
deterministicPassphrase
|
||||||
|
))
|
||||||
potentialPrivSigningKey = hashlib.sha512(
|
potentialPrivSigningKey = hashlib.sha512(
|
||||||
deterministicPassphrase +
|
deterministicPassphrase.encode('raw_unicode_escape') +
|
||||||
encodeVarint(signingKeyNonce)
|
encodeVarint(signingKeyNonce)
|
||||||
).digest()[:32]
|
).digest()[:32]
|
||||||
|
logger.error('++++++++++428++++++++++++++')
|
||||||
|
logger.error('++++++++++++429-{}+++++++++'.format(
|
||||||
|
encryptionKeyNonce
|
||||||
|
))
|
||||||
potentialPrivEncryptionKey = hashlib.sha512(
|
potentialPrivEncryptionKey = hashlib.sha512(
|
||||||
deterministicPassphrase +
|
deterministicPassphrase.encode('raw_unicode_escape') +
|
||||||
encodeVarint(encryptionKeyNonce)
|
encodeVarint(encryptionKeyNonce)
|
||||||
).digest()[:32]
|
).digest()[:32]
|
||||||
|
logger.error('++++++++++433++++++++++++++')
|
||||||
potentialPubSigningKey = highlevelcrypto.pointMult(
|
potentialPubSigningKey = highlevelcrypto.pointMult(
|
||||||
potentialPrivSigningKey)
|
potentialPrivSigningKey)
|
||||||
|
logger.error('++++++++++437++++++++++++++')
|
||||||
potentialPubEncryptionKey = highlevelcrypto.pointMult(
|
potentialPubEncryptionKey = highlevelcrypto.pointMult(
|
||||||
potentialPrivEncryptionKey)
|
potentialPrivEncryptionKey)
|
||||||
|
logger.error('++++++++++439++++++++++++++')
|
||||||
signingKeyNonce += 2
|
signingKeyNonce += 2
|
||||||
|
logger.error('++++++++++441++++++++++++++')
|
||||||
encryptionKeyNonce += 2
|
encryptionKeyNonce += 2
|
||||||
|
logger.error('++++++++++443++++++++++++++')
|
||||||
sha = hashlib.new('sha512')
|
sha = hashlib.new('sha512')
|
||||||
sha.update(
|
sha.update(
|
||||||
potentialPubSigningKey + potentialPubEncryptionKey)
|
potentialPubSigningKey + potentialPubEncryptionKey)
|
||||||
|
logger.error('++++++++++447++++++++++++++')
|
||||||
ripe = RIPEMD160Hash(sha.digest()).digest()
|
ripe = RIPEMD160Hash(sha.digest()).digest()
|
||||||
|
logger.error('++++++++++449++++++++++++++')
|
||||||
if (
|
if (
|
||||||
ripe[:numberOfNullBytesDemandedOnFrontOfRipeHash] ==
|
ripe[:numberOfNullBytesDemandedOnFrontOfRipeHash] ==
|
||||||
'\x00'.encode() * numberOfNullBytesDemandedOnFrontOfRipeHash
|
'\x00'.encode() * numberOfNullBytesDemandedOnFrontOfRipeHash
|
||||||
):
|
):
|
||||||
|
logger.error('++++++++++454++++++++++++++')
|
||||||
break
|
break
|
||||||
|
logger.error('++++++++++418++++++++++++++')
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
'Generated address with ripe digest: %s', hexlify(ripe))
|
'Generated address with ripe digest: %s', hexlify(ripe))
|
||||||
try:
|
try:
|
||||||
|
logger.error('++++++++++460++++++++++++++')
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
'Address generator calculated %s addresses'
|
'Address generator calculated %s addresses'
|
||||||
' at %s addresses per second before finding'
|
' at %s addresses per second before finding'
|
||||||
|
@ -441,51 +463,76 @@ class addressGenerator(StoppableThread):
|
||||||
(time.time() - startTime)
|
(time.time() - startTime)
|
||||||
)
|
)
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
|
logger.error('++++++++++470++++++++++++++')
|
||||||
|
|
||||||
# The user must have a pretty fast computer.
|
# The user must have a pretty fast computer.
|
||||||
# time.time() - startTime equaled zero.
|
# time.time() - startTime equaled zero.
|
||||||
pass
|
pass
|
||||||
|
logger.error('++++++++++475++++++++++++++')
|
||||||
|
|
||||||
address = encodeAddress(
|
address = encodeAddress(
|
||||||
addressVersionNumber, streamNumber, ripe)
|
addressVersionNumber, streamNumber, ripe)
|
||||||
|
logger.error('++++++++++479++++++++++++++')
|
||||||
|
|
||||||
saveAddressToDisk = True
|
saveAddressToDisk = True
|
||||||
# If we are joining an existing chan, let us check
|
# If we are joining an existing chan, let us check
|
||||||
# to make sure it matches the provided Bitmessage address
|
# to make sure it matches the provided Bitmessage address
|
||||||
|
logger.error('++++++++++484++++++++++++++')
|
||||||
|
|
||||||
if command == 'joinChan':
|
if command == 'joinChan':
|
||||||
|
logger.error('++++++++++487++++++++++++++')
|
||||||
|
|
||||||
if address != chanAddress:
|
if address != chanAddress:
|
||||||
|
logger.error('++++++++++490++++++++++++++')
|
||||||
|
|
||||||
listOfNewAddressesToSendOutThroughTheAPI.append(
|
listOfNewAddressesToSendOutThroughTheAPI.append(
|
||||||
'chan name does not match address')
|
'chan name does not match address')
|
||||||
|
logger.error('++++++++++494++++++++++++++')
|
||||||
saveAddressToDisk = False
|
saveAddressToDisk = False
|
||||||
if command == 'getDeterministicAddress':
|
if command == 'getDeterministicAddress':
|
||||||
saveAddressToDisk = False
|
saveAddressToDisk = False
|
||||||
|
logger.error('++++++++++498++++++++++++++')
|
||||||
|
|
||||||
|
|
||||||
if saveAddressToDisk and live:
|
if saveAddressToDisk and live:
|
||||||
|
logger.error('++++++++++501++++++++++++++')
|
||||||
|
|
||||||
# An excellent way for us to store our keys is
|
# An excellent way for us to store our keys is
|
||||||
# in Wallet Import Format. Let us convert now.
|
# in Wallet Import Format. Let us convert now.
|
||||||
# https://en.bitcoin.it/wiki/Wallet_import_format
|
# https://en.bitcoin.it/wiki/Wallet_import_format
|
||||||
privSigningKey = '\x80'.encode('raw_unicode_escape') + potentialPrivSigningKey
|
privSigningKey = '\x80'.encode('raw_unicode_escape') + potentialPrivSigningKey
|
||||||
|
logger.error('++++++++++508++++++++++++++')
|
||||||
|
|
||||||
checksum = hashlib.sha256(hashlib.sha256(
|
checksum = hashlib.sha256(hashlib.sha256(
|
||||||
privSigningKey).digest()).digest()[0:4]
|
privSigningKey).digest()).digest()[0:4]
|
||||||
|
logger.error('++++++++++512++++++++++++++')
|
||||||
privSigningKeyWIF = arithmetic.changebase(
|
privSigningKeyWIF = arithmetic.changebase(
|
||||||
privSigningKey + checksum, 256, 58)
|
privSigningKey + checksum, 256, 58)
|
||||||
|
logger.error('++++++++++515++++++++++++++')
|
||||||
privEncryptionKey = '\x80'.encode('raw_unicode_escape') + \
|
privEncryptionKey = '\x80'.encode('raw_unicode_escape') + \
|
||||||
potentialPrivEncryptionKey
|
potentialPrivEncryptionKey
|
||||||
|
logger.error('++++++++++518++++++++++++++')
|
||||||
checksum = hashlib.sha256(hashlib.sha256(
|
checksum = hashlib.sha256(hashlib.sha256(
|
||||||
privEncryptionKey).digest()).digest()[0:4]
|
privEncryptionKey).digest()).digest()[0:4]
|
||||||
|
logger.error('++++++++++521++++++++++++++')
|
||||||
privEncryptionKeyWIF = arithmetic.changebase(
|
privEncryptionKeyWIF = arithmetic.changebase(
|
||||||
privEncryptionKey + checksum, 256, 58)
|
privEncryptionKey + checksum, 256, 58)
|
||||||
|
logger.error('++++++++++524++++++++++++++')
|
||||||
try:
|
try:
|
||||||
|
logger.error('++++++++++526++++++++++++++')
|
||||||
BMConfigParser().add_section(address)
|
BMConfigParser().add_section(address)
|
||||||
addressAlreadyExists = False
|
addressAlreadyExists = False
|
||||||
except:
|
except:
|
||||||
|
logger.error('++++++++++530++++++++++++++')
|
||||||
addressAlreadyExists = True
|
addressAlreadyExists = True
|
||||||
|
|
||||||
if addressAlreadyExists:
|
if addressAlreadyExists:
|
||||||
|
logger.error('++++++++++534++++++++++++++')
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
'%s already exists. Not adding it again.',
|
'%s already exists. Not adding it again.',
|
||||||
address
|
address
|
||||||
)
|
)
|
||||||
|
logger.error('++++++++++539++++++++++++++')
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
tr._translate(
|
tr._translate(
|
||||||
|
@ -495,49 +542,63 @@ class addressGenerator(StoppableThread):
|
||||||
).arg(address)
|
).arg(address)
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
|
logger.error('++++++++++549++++++++++++++')
|
||||||
self.logger.debug('label: %s', label)
|
self.logger.debug('label: %s', label)
|
||||||
BMConfigParser().set(address, 'label', label)
|
BMConfigParser().set(address, 'label', label)
|
||||||
BMConfigParser().set(address, 'enabled', 'true')
|
BMConfigParser().set(address, 'enabled', 'true')
|
||||||
BMConfigParser().set(address, 'decoy', 'false')
|
BMConfigParser().set(address, 'decoy', 'false')
|
||||||
|
logger.error('++++++++++554++++++++++++++')
|
||||||
# if command == 'joinChan' or command == 'createChan':
|
# if command == 'joinChan' or command == 'createChan':
|
||||||
if command in ('joinChan', 'createChan'):
|
if command in ('joinChan', 'createChan'):
|
||||||
BMConfigParser().set(address, 'chan', 'true')
|
BMConfigParser().set(address, 'chan', 'true')
|
||||||
|
logger.error('++++++++++558++++++++++++++')
|
||||||
BMConfigParser().set(
|
BMConfigParser().set(
|
||||||
address, 'noncetrialsperbyte',
|
address, 'noncetrialsperbyte',
|
||||||
str(nonceTrialsPerByte))
|
str(nonceTrialsPerByte))
|
||||||
|
logger.error('++++++++++562++++++++++++++')
|
||||||
BMConfigParser().set(
|
BMConfigParser().set(
|
||||||
address, 'payloadlengthextrabytes',
|
address, 'payloadlengthextrabytes',
|
||||||
str(payloadLengthExtraBytes))
|
str(payloadLengthExtraBytes))
|
||||||
|
logger.error('++++++++++566++++++++++++++')
|
||||||
BMConfigParser().set(
|
BMConfigParser().set(
|
||||||
address, 'privSigningKey',
|
address, 'privSigningKey',
|
||||||
privSigningKeyWIF)
|
privSigningKeyWIF)
|
||||||
|
logger.error('++++++++++570++++++++++++++')
|
||||||
BMConfigParser().set(
|
BMConfigParser().set(
|
||||||
address, 'privEncryptionKey',
|
address, 'privEncryptionKey',
|
||||||
privEncryptionKeyWIF)
|
privEncryptionKeyWIF)
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
|
logger.error('++++++++++575++++++++++++++')
|
||||||
|
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'writeNewAddressToTable',
|
'writeNewAddressToTable',
|
||||||
(label, address, str(streamNumber))
|
(label, address, str(streamNumber))
|
||||||
))
|
))
|
||||||
|
logger.error('++++++++++581++++++++++++++')
|
||||||
listOfNewAddressesToSendOutThroughTheAPI.append(
|
listOfNewAddressesToSendOutThroughTheAPI.append(
|
||||||
address)
|
address)
|
||||||
|
logger.error('++++++++++584++++++++++++++')
|
||||||
shared.myECCryptorObjects[ripe] = \
|
shared.myECCryptorObjects[ripe] = \
|
||||||
highlevelcrypto.makeCryptor(
|
highlevelcrypto.makeCryptor(
|
||||||
hexlify(potentialPrivEncryptionKey))
|
hexlify(potentialPrivEncryptionKey))
|
||||||
|
logger.error('++++++++++588++++++++++++++')
|
||||||
shared.myAddressesByHash[ripe] = address
|
shared.myAddressesByHash[ripe] = address
|
||||||
tag = hashlib.sha512(hashlib.sha512(
|
tag = hashlib.sha512(hashlib.sha512(
|
||||||
encodeVarint(addressVersionNumber) +
|
encodeVarint(addressVersionNumber) +
|
||||||
encodeVarint(streamNumber) + ripe
|
encodeVarint(streamNumber) + ripe
|
||||||
).digest()).digest()[32:]
|
).digest()).digest()[32:]
|
||||||
|
logger.error('++++++++++594++++++++++++++')
|
||||||
shared.myAddressesByTag[tag] = address
|
shared.myAddressesByTag[tag] = address
|
||||||
if addressVersionNumber == 3:
|
if addressVersionNumber == 3:
|
||||||
|
logger.error('++++++++++597++++++++++++++')
|
||||||
|
|
||||||
# If this is a chan address,
|
# If this is a chan address,
|
||||||
# the worker thread won't send out
|
# the worker thread won't send out
|
||||||
# the pubkey over the network.
|
# the pubkey over the network.
|
||||||
queues.workerQueue.put((
|
queues.workerQueue.put((
|
||||||
'sendOutOrStoreMyV3Pubkey', ripe))
|
'sendOutOrStoreMyV3Pubkey', ripe))
|
||||||
elif addressVersionNumber == 4:
|
elif addressVersionNumber == 4:
|
||||||
|
logger.error('++++++++++605++++++++++++++')
|
||||||
queues.workerQueue.put((
|
queues.workerQueue.put((
|
||||||
'sendOutOrStoreMyV4Pubkey', address))
|
'sendOutOrStoreMyV4Pubkey', address))
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
|
@ -553,10 +614,12 @@ class addressGenerator(StoppableThread):
|
||||||
# Done generating addresses.
|
# Done generating addresses.
|
||||||
# if command == 'createDeterministicAddresses' \
|
# if command == 'createDeterministicAddresses' \
|
||||||
# or command == 'joinChan' or command == 'createChan':
|
# or command == 'joinChan' or command == 'createChan':
|
||||||
|
logger.error('++++++++++621++++++++++++++')
|
||||||
if command in (
|
if command in (
|
||||||
'createDeterministicAddresses',
|
'createDeterministicAddresses',
|
||||||
'joinChan',
|
'joinChan',
|
||||||
'createChan'):
|
'createChan'):
|
||||||
|
logger.error('++++++++++++++626+++++++++++')
|
||||||
queues.apiAddressGeneratorReturnQueue.put(
|
queues.apiAddressGeneratorReturnQueue.put(
|
||||||
listOfNewAddressesToSendOutThroughTheAPI)
|
listOfNewAddressesToSendOutThroughTheAPI)
|
||||||
elif command == 'getDeterministicAddress':
|
elif command == 'getDeterministicAddress':
|
||||||
|
|
|
@ -26,6 +26,7 @@ except ModuleNotFoundError:
|
||||||
from pybitmessage.queues import (
|
from pybitmessage.queues import (
|
||||||
addressGeneratorQueue, objectProcessorQueue, UISignalQueue, workerQueue)
|
addressGeneratorQueue, objectProcessorQueue, UISignalQueue, workerQueue)
|
||||||
|
|
||||||
|
from pybitmessage.tests.test_process import TestProcessProto
|
||||||
def doCleanShutdown():
|
def doCleanShutdown():
|
||||||
"""
|
"""
|
||||||
Used to tell all the treads to finish work and exit.
|
Used to tell all the treads to finish work and exit.
|
||||||
|
@ -35,8 +36,6 @@ def doCleanShutdown():
|
||||||
objectProcessorQueue.put(('checkShutdownVariable', 'no data'))
|
objectProcessorQueue.put(('checkShutdownVariable', 'no data'))
|
||||||
for thread in threading.enumerate():
|
for thread in threading.enumerate():
|
||||||
if thread.isAlive() and isinstance(thread, StoppableThread):
|
if thread.isAlive() and isinstance(thread, StoppableThread):
|
||||||
logger.error('!!!! thread !!! -{}'.format(
|
|
||||||
thread))
|
|
||||||
thread.stopThread()
|
thread.stopThread()
|
||||||
|
|
||||||
UISignalQueue.put((
|
UISignalQueue.put((
|
||||||
|
@ -67,23 +66,6 @@ def doCleanShutdown():
|
||||||
time.sleep(.25)
|
time.sleep(.25)
|
||||||
|
|
||||||
for thread in threading.enumerate():
|
for thread in threading.enumerate():
|
||||||
if thread.name == 'singleAPI':
|
|
||||||
try:
|
|
||||||
logger.error('inside the shutdown try')
|
|
||||||
logger.error(
|
|
||||||
'thread flag -{}'.format(
|
|
||||||
thread.stop._flag))
|
|
||||||
thread.stop.set()
|
|
||||||
thread.stop.clear()
|
|
||||||
logger.error(
|
|
||||||
'After set clear thread flag -{}'.format(
|
|
||||||
thread.stop._flag))
|
|
||||||
# thread.stop.set()
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(
|
|
||||||
'======inside the shutdown except======='
|
|
||||||
)
|
|
||||||
logger.error(str(e))
|
|
||||||
if (
|
if (
|
||||||
thread is not threading.currentThread()
|
thread is not threading.currentThread()
|
||||||
and isinstance(thread, StoppableThread)
|
and isinstance(thread, StoppableThread)
|
||||||
|
|
Reference in New Issue
Block a user