V0.6 #852
|
@ -84,7 +84,7 @@ class addressGenerator(threading.Thread, StoppableThread):
|
||||||
payloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
|
payloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
|
||||||
if command == 'createRandomAddress':
|
if command == 'createRandomAddress':
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', tr.translateText("MainWindow", "Generating one new address")))
|
'updateStatusBar', tr._translate("MainWindow", "Generating one new address")))
|
||||||
# This next section is a little bit strange. We're going to generate keys over and over until we
|
# This next section is a little bit strange. We're going to generate keys over and over until we
|
||||||
# find one that starts with either \x00 or \x00\x00. Then when we pack them into a Bitmessage address,
|
# find one that starts with either \x00 or \x00\x00. Then when we pack them into a Bitmessage address,
|
||||||
# we won't store the \x00 or \x00\x00 bytes thus making the
|
# we won't store the \x00 or \x00\x00 bytes thus making the
|
||||||
|
@ -146,7 +146,7 @@ class addressGenerator(threading.Thread, StoppableThread):
|
||||||
shared.apiAddressGeneratorReturnQueue.put(address)
|
shared.apiAddressGeneratorReturnQueue.put(address)
|
||||||
|
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', tr.translateText("MainWindow", "Done generating address. Doing work necessary to broadcast it...")))
|
'updateStatusBar', tr._translate("MainWindow", "Done generating address. Doing work necessary to broadcast it...")))
|
||||||
shared.UISignalQueue.put(('writeNewAddressToTable', (
|
shared.UISignalQueue.put(('writeNewAddressToTable', (
|
||||||
label, address, streamNumber)))
|
label, address, streamNumber)))
|
||||||
shared.reloadMyAddressHashes()
|
shared.reloadMyAddressHashes()
|
||||||
|
@ -163,7 +163,7 @@ class addressGenerator(threading.Thread, StoppableThread):
|
||||||
'WARNING: You are creating deterministic address(es) using a blank passphrase. Bitmessage will do it but it is rather stupid.')
|
'WARNING: You are creating deterministic address(es) using a blank passphrase. Bitmessage will do it but it is rather stupid.')
|
||||||
if command == 'createDeterministicAddresses':
|
if command == 'createDeterministicAddresses':
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', tr.translateText("MainWindow","Generating %1 new addresses.").arg(str(numberOfAddressesToMake))))
|
'updateStatusBar', tr._translate("MainWindow","Generating %1 new addresses.").arg(str(numberOfAddressesToMake))))
|
||||||
signingKeyNonce = 0
|
signingKeyNonce = 0
|
||||||
encryptionKeyNonce = 1
|
encryptionKeyNonce = 1
|
||||||
listOfNewAddressesToSendOutThroughTheAPI = [
|
listOfNewAddressesToSendOutThroughTheAPI = [
|
||||||
|
@ -240,7 +240,7 @@ class addressGenerator(threading.Thread, StoppableThread):
|
||||||
if addressAlreadyExists:
|
if addressAlreadyExists:
|
||||||
logger.info('%s already exists. Not adding it again.' % address)
|
logger.info('%s already exists. Not adding it again.' % address)
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', tr.translateText("MainWindow","%1 is already in 'Your Identities'. Not adding it again.").arg(address)))
|
'updateStatusBar', tr._translate("MainWindow","%1 is already in 'Your Identities'. Not adding it again.").arg(address)))
|
||||||
else:
|
else:
|
||||||
logger.debug('label: %s' % label)
|
logger.debug('label: %s' % label)
|
||||||
shared.config.set(address, 'label', label)
|
shared.config.set(address, 'label', label)
|
||||||
|
@ -276,7 +276,7 @@ class addressGenerator(threading.Thread, StoppableThread):
|
||||||
shared.workerQueue.put((
|
shared.workerQueue.put((
|
||||||
'sendOutOrStoreMyV4Pubkey', address))
|
'sendOutOrStoreMyV4Pubkey', address))
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', tr.translateText("MainWindow", "Done generating address")))
|
'updateStatusBar', tr._translate("MainWindow", "Done generating address")))
|
||||||
|
|
||||||
|
|
||||||
# Done generating addresses.
|
# Done generating addresses.
|
||||||
|
|
|
@ -325,7 +325,7 @@ class objectProcessor(threading.Thread):
|
||||||
'ackreceived',
|
'ackreceived',
|
||||||
int(time.time()),
|
int(time.time()),
|
||||||
data[-32:])
|
data[-32:])
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (data[-32:], tr.translateText("MainWindow",'Acknowledgement of the message received %1').arg(l10n.formatTimestamp()))))
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (data[-32:], tr._translate("MainWindow",'Acknowledgement of the message received %1').arg(l10n.formatTimestamp()))))
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
logger.info('This was NOT an acknowledgement bound for me.')
|
logger.info('This was NOT an acknowledgement bound for me.')
|
||||||
|
|
|
@ -208,7 +208,7 @@ class outgoingSynSender(threading.Thread, StoppableThread):
|
||||||
|
|
||||||
except socks.Socks5AuthError as err:
|
except socks.Socks5AuthError as err:
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', tr.translateText(
|
'updateStatusBar', tr._translate(
|
||||||
"MainWindow", "SOCKS5 Authentication problem: %1").arg(str(err))))
|
"MainWindow", "SOCKS5 Authentication problem: %1").arg(str(err))))
|
||||||
except socks.Socks5Error as err:
|
except socks.Socks5Error as err:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -90,7 +90,7 @@ class singleCleaner(threading.Thread, StoppableThread):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if "Errno 28" in str(err):
|
if "Errno 28" in str(err):
|
||||||
logger.fatal('(while receiveDataThread shared.needToWriteKnownNodesToDisk) Alert: Your disk or data storage volume is full. ')
|
logger.fatal('(while receiveDataThread shared.needToWriteKnownNodesToDisk) Alert: Your disk or data storage volume is full. ')
|
||||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
shared.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||||
if shared.daemon:
|
if shared.daemon:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
shared.knownNodesLock.release()
|
shared.knownNodesLock.release()
|
||||||
|
|
|
@ -389,7 +389,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
fromaddress, 'privencryptionkey')
|
fromaddress, 'privencryptionkey')
|
||||||
except:
|
except:
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
||||||
ackdata, tr.translateText("MainWindow", "Error! Could not find sender address (your address) in the keys.dat file."))))
|
ackdata, tr._translate("MainWindow", "Error! Could not find sender address (your address) in the keys.dat file."))))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
privSigningKeyHex = hexlify(shared.decodeWalletImportFormat(
|
privSigningKeyHex = hexlify(shared.decodeWalletImportFormat(
|
||||||
|
@ -461,7 +461,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
target = 2 ** 64 / (shared.networkDefaultProofOfWorkNonceTrialsPerByte*(len(payload) + 8 + shared.networkDefaultPayloadLengthExtraBytes + ((TTL*(len(payload)+8+shared.networkDefaultPayloadLengthExtraBytes))/(2 ** 16))))
|
target = 2 ** 64 / (shared.networkDefaultProofOfWorkNonceTrialsPerByte*(len(payload) + 8 + shared.networkDefaultPayloadLengthExtraBytes + ((TTL*(len(payload)+8+shared.networkDefaultPayloadLengthExtraBytes))/(2 ** 16))))
|
||||||
logger.info('(For broadcast message) Doing proof of work...')
|
logger.info('(For broadcast message) Doing proof of work...')
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
||||||
ackdata, tr.translateText("MainWindow", "Doing work necessary to send broadcast..."))))
|
ackdata, tr._translate("MainWindow", "Doing work necessary to send broadcast..."))))
|
||||||
initialHash = hashlib.sha512(payload).digest()
|
initialHash = hashlib.sha512(payload).digest()
|
||||||
trialValue, nonce = proofofwork.run(target, initialHash)
|
trialValue, nonce = proofofwork.run(target, initialHash)
|
||||||
logger.info('(For broadcast message) Found proof of work ' + str(trialValue) + ' Nonce: ' + str(nonce))
|
logger.info('(For broadcast message) Found proof of work ' + str(trialValue) + ' Nonce: ' + str(nonce))
|
||||||
|
@ -483,7 +483,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
shared.broadcastToSendDataQueues((
|
shared.broadcastToSendDataQueues((
|
||||||
streamNumber, 'advertiseobject', inventoryHash))
|
streamNumber, 'advertiseobject', inventoryHash))
|
||||||
|
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Broadcast sent on %1").arg(l10n.formatTimestamp()))))
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr._translate("MainWindow", "Broadcast sent on %1").arg(l10n.formatTimestamp()))))
|
||||||
|
|
||||||
# Update the status of the message in the 'sent' table to have
|
# Update the status of the message in the 'sent' table to have
|
||||||
# a 'broadcastsent' status
|
# a 'broadcastsent' status
|
||||||
|
@ -555,7 +555,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
int(time.time()) + 2.5*24*60*60,
|
int(time.time()) + 2.5*24*60*60,
|
||||||
toaddress)
|
toaddress)
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByToAddress', (
|
shared.UISignalQueue.put(('updateSentItemStatusByToAddress', (
|
||||||
toaddress, tr.translateText("MainWindow",'Encryption key was requested earlier.'))))
|
toaddress, tr._translate("MainWindow",'Encryption key was requested earlier.'))))
|
||||||
continue #on with the next msg on which we can do some work
|
continue #on with the next msg on which we can do some work
|
||||||
else:
|
else:
|
||||||
# We have not yet sent a request for the pubkey
|
# We have not yet sent a request for the pubkey
|
||||||
|
@ -592,7 +592,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
'''UPDATE sent SET status='doingpubkeypow' WHERE toaddress=? AND status='msgqueued' ''',
|
'''UPDATE sent SET status='doingpubkeypow' WHERE toaddress=? AND status='msgqueued' ''',
|
||||||
toaddress)
|
toaddress)
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByToAddress', (
|
shared.UISignalQueue.put(('updateSentItemStatusByToAddress', (
|
||||||
toaddress, tr.translateText("MainWindow",'Sending a request for the recipient\'s encryption key.'))))
|
toaddress, tr._translate("MainWindow",'Sending a request for the recipient\'s encryption key.'))))
|
||||||
self.requestPubKey(toaddress)
|
self.requestPubKey(toaddress)
|
||||||
continue #on with the next msg on which we can do some work
|
continue #on with the next msg on which we can do some work
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
if not shared.config.has_section(toaddress): # if we aren't sending this to ourselves or a chan
|
if not shared.config.has_section(toaddress): # if we aren't sending this to ourselves or a chan
|
||||||
shared.ackdataForWhichImWatching[ackdata] = 0
|
shared.ackdataForWhichImWatching[ackdata] = 0
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
||||||
ackdata, tr.translateText("MainWindow", "Looking up the receiver\'s public key"))))
|
ackdata, tr._translate("MainWindow", "Looking up the receiver\'s public key"))))
|
||||||
logger.info('Sending a message.')
|
logger.info('Sending a message.')
|
||||||
logger.debug('First 150 characters of message: ' + repr(message[:150]))
|
logger.debug('First 150 characters of message: ' + repr(message[:150]))
|
||||||
|
|
||||||
|
@ -642,7 +642,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
if shared.isBitSetWithinBitfield(behaviorBitfield,30): # if receiver is a mobile device who expects that their address RIPE is included unencrypted on the front of the message..
|
if shared.isBitSetWithinBitfield(behaviorBitfield,30): # if receiver is a mobile device who expects that their address RIPE is included unencrypted on the front of the message..
|
||||||
if not shared.safeConfigGetBoolean('bitmessagesettings','willinglysendtomobile'): # if we are Not willing to include the receiver's RIPE hash on the message..
|
if not shared.safeConfigGetBoolean('bitmessagesettings','willinglysendtomobile'): # if we are Not willing to include the receiver's RIPE hash on the message..
|
||||||
logger.info('The receiver is a mobile user but the sender (you) has not selected that you are willing to send to mobiles. Aborting send.')
|
logger.info('The receiver is a mobile user but the sender (you) has not selected that you are willing to send to mobiles. Aborting send.')
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr.translateText("MainWindow",'Problem: Destination is a mobile device who requests that the destination be included in the message but this is disallowed in your settings. %1').arg(l10n.formatTimestamp()))))
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr._translate("MainWindow",'Problem: Destination is a mobile device who requests that the destination be included in the message but this is disallowed in your settings. %1').arg(l10n.formatTimestamp()))))
|
||||||
# if the human changes their setting and then sends another message or restarts their client, this one will send at that time.
|
# if the human changes their setting and then sends another message or restarts their client, this one will send at that time.
|
||||||
continue
|
continue
|
||||||
readPosition += 4 # to bypass the bitfield of behaviors
|
readPosition += 4 # to bypass the bitfield of behaviors
|
||||||
|
@ -657,7 +657,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
requiredAverageProofOfWorkNonceTrialsPerByte = shared.networkDefaultProofOfWorkNonceTrialsPerByte
|
requiredAverageProofOfWorkNonceTrialsPerByte = shared.networkDefaultProofOfWorkNonceTrialsPerByte
|
||||||
requiredPayloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
|
requiredPayloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
||||||
ackdata, tr.translateText("MainWindow", "Doing work necessary to send message.\nThere is no required difficulty for version 2 addresses like this."))))
|
ackdata, tr._translate("MainWindow", "Doing work necessary to send message.\nThere is no required difficulty for version 2 addresses like this."))))
|
||||||
elif toAddressVersionNumber >= 3:
|
elif toAddressVersionNumber >= 3:
|
||||||
requiredAverageProofOfWorkNonceTrialsPerByte, varintLength = decodeVarint(
|
requiredAverageProofOfWorkNonceTrialsPerByte, varintLength = decodeVarint(
|
||||||
pubkeyPayload[readPosition:readPosition + 10])
|
pubkeyPayload[readPosition:readPosition + 10])
|
||||||
|
@ -670,7 +670,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
if requiredPayloadLengthExtraBytes < shared.networkDefaultPayloadLengthExtraBytes:
|
if requiredPayloadLengthExtraBytes < shared.networkDefaultPayloadLengthExtraBytes:
|
||||||
requiredPayloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
|
requiredPayloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
|
||||||
logger.debug('Using averageProofOfWorkNonceTrialsPerByte: %s and payloadLengthExtraBytes: %s.' % (requiredAverageProofOfWorkNonceTrialsPerByte, requiredPayloadLengthExtraBytes))
|
logger.debug('Using averageProofOfWorkNonceTrialsPerByte: %s and payloadLengthExtraBytes: %s.' % (requiredAverageProofOfWorkNonceTrialsPerByte, requiredPayloadLengthExtraBytes))
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Doing work necessary to send message.\nReceiver\'s required difficulty: %1 and %2").arg(str(float(
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr._translate("MainWindow", "Doing work necessary to send message.\nReceiver\'s required difficulty: %1 and %2").arg(str(float(
|
||||||
requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(str(float(requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes)))))
|
requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(str(float(requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes)))))
|
||||||
if status != 'forcepow':
|
if status != 'forcepow':
|
||||||
if (requiredAverageProofOfWorkNonceTrialsPerByte > shared.config.getint('bitmessagesettings', 'maxacceptablenoncetrialsperbyte') and shared.config.getint('bitmessagesettings', 'maxacceptablenoncetrialsperbyte') != 0) or (requiredPayloadLengthExtraBytes > shared.config.getint('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') and shared.config.getint('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') != 0):
|
if (requiredAverageProofOfWorkNonceTrialsPerByte > shared.config.getint('bitmessagesettings', 'maxacceptablenoncetrialsperbyte') and shared.config.getint('bitmessagesettings', 'maxacceptablenoncetrialsperbyte') != 0) or (requiredPayloadLengthExtraBytes > shared.config.getint('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') and shared.config.getint('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') != 0):
|
||||||
|
@ -679,7 +679,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET status='toodifficult' WHERE ackdata=? ''',
|
'''UPDATE sent SET status='toodifficult' WHERE ackdata=? ''',
|
||||||
ackdata)
|
ackdata)
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Problem: The work demanded by the recipient (%1 and %2) is more difficult than you are willing to do. %3").arg(str(float(requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(str(float(
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr._translate("MainWindow", "Problem: The work demanded by the recipient (%1 and %2) is more difficult than you are willing to do. %3").arg(str(float(requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(str(float(
|
||||||
requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes)).arg(l10n.formatTimestamp()))))
|
requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes)).arg(l10n.formatTimestamp()))))
|
||||||
continue
|
continue
|
||||||
else: # if we are sending a message to ourselves or a chan..
|
else: # if we are sending a message to ourselves or a chan..
|
||||||
|
@ -691,7 +691,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
privEncryptionKeyBase58 = shared.config.get(
|
privEncryptionKeyBase58 = shared.config.get(
|
||||||
toaddress, 'privencryptionkey')
|
toaddress, 'privencryptionkey')
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr.translateText("MainWindow",'Problem: You are trying to send a message to yourself or a chan but your encryption key could not be found in the keys.dat file. Could not encrypt message. %1').arg(l10n.formatTimestamp()))))
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr._translate("MainWindow",'Problem: You are trying to send a message to yourself or a chan but your encryption key could not be found in the keys.dat file. Could not encrypt message. %1').arg(l10n.formatTimestamp()))))
|
||||||
logger.error('Error within sendMsg. Could not read the keys from the keys.dat file for our own address. %s\n' % err)
|
logger.error('Error within sendMsg. Could not read the keys from the keys.dat file for our own address. %s\n' % err)
|
||||||
continue
|
continue
|
||||||
privEncryptionKeyHex = hexlify(shared.decodeWalletImportFormat(
|
privEncryptionKeyHex = hexlify(shared.decodeWalletImportFormat(
|
||||||
|
@ -701,7 +701,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
requiredAverageProofOfWorkNonceTrialsPerByte = shared.networkDefaultProofOfWorkNonceTrialsPerByte
|
requiredAverageProofOfWorkNonceTrialsPerByte = shared.networkDefaultProofOfWorkNonceTrialsPerByte
|
||||||
requiredPayloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
|
requiredPayloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
||||||
ackdata, tr.translateText("MainWindow", "Doing work necessary to send message."))))
|
ackdata, tr._translate("MainWindow", "Doing work necessary to send message."))))
|
||||||
|
|
||||||
# Now we can start to assemble our message.
|
# Now we can start to assemble our message.
|
||||||
payload = encodeVarint(fromAddressVersionNumber)
|
payload = encodeVarint(fromAddressVersionNumber)
|
||||||
|
@ -717,7 +717,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
fromaddress, 'privencryptionkey')
|
fromaddress, 'privencryptionkey')
|
||||||
except:
|
except:
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
||||||
ackdata, tr.translateText("MainWindow", "Error! Could not find sender address (your address) in the keys.dat file."))))
|
ackdata, tr._translate("MainWindow", "Error! Could not find sender address (your address) in the keys.dat file."))))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
privSigningKeyHex = hexlify(shared.decodeWalletImportFormat(
|
privSigningKeyHex = hexlify(shared.decodeWalletImportFormat(
|
||||||
|
@ -777,7 +777,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
encrypted = highlevelcrypto.encrypt(payload,"04"+hexlify(pubEncryptionKeyBase256))
|
encrypted = highlevelcrypto.encrypt(payload,"04"+hexlify(pubEncryptionKeyBase256))
|
||||||
except:
|
except:
|
||||||
sqlExecute('''UPDATE sent SET status='badkey' WHERE ackdata=?''', ackdata)
|
sqlExecute('''UPDATE sent SET status='badkey' WHERE ackdata=?''', ackdata)
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr.translateText("MainWindow",'Problem: The recipient\'s encryption key is no good. Could not encrypt message. %1').arg(l10n.formatTimestamp()))))
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr._translate("MainWindow",'Problem: The recipient\'s encryption key is no good. Could not encrypt message. %1').arg(l10n.formatTimestamp()))))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
encryptedPayload = pack('>Q', embeddedTime)
|
encryptedPayload = pack('>Q', embeddedTime)
|
||||||
|
@ -810,10 +810,10 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
shared.inventory[inventoryHash] = (
|
shared.inventory[inventoryHash] = (
|
||||||
objectType, toStreamNumber, encryptedPayload, embeddedTime, '')
|
objectType, toStreamNumber, encryptedPayload, embeddedTime, '')
|
||||||
if shared.config.has_section(toaddress) or not checkBitfield(behaviorBitfield, shared.BITFIELD_DOESACK):
|
if shared.config.has_section(toaddress) or not checkBitfield(behaviorBitfield, shared.BITFIELD_DOESACK):
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Message sent. Sent at %1").arg(l10n.formatTimestamp()))))
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr._translate("MainWindow", "Message sent. Sent at %1").arg(l10n.formatTimestamp()))))
|
||||||
else:
|
else:
|
||||||
# not sending to a chan or one of my addresses
|
# not sending to a chan or one of my addresses
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Message sent. Waiting for acknowledgement. Sent on %1").arg(l10n.formatTimestamp()))))
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr._translate("MainWindow", "Message sent. Waiting for acknowledgement. Sent on %1").arg(l10n.formatTimestamp()))))
|
||||||
logger.info('Broadcasting inv for my msg(within sendmsg function):' + hexlify(inventoryHash))
|
logger.info('Broadcasting inv for my msg(within sendmsg function):' + hexlify(inventoryHash))
|
||||||
shared.broadcastToSendDataQueues((
|
shared.broadcastToSendDataQueues((
|
||||||
toStreamNumber, 'advertiseobject', inventoryHash))
|
toStreamNumber, 'advertiseobject', inventoryHash))
|
||||||
|
@ -906,7 +906,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
statusbar = 'Doing the computations necessary to request the recipient\'s public key.'
|
statusbar = 'Doing the computations necessary to request the recipient\'s public key.'
|
||||||
shared.UISignalQueue.put(('updateStatusBar', statusbar))
|
shared.UISignalQueue.put(('updateStatusBar', statusbar))
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByToAddress', (
|
shared.UISignalQueue.put(('updateSentItemStatusByToAddress', (
|
||||||
toAddress, tr.translateText("MainWindow",'Doing work necessary to request encryption key.'))))
|
toAddress, tr._translate("MainWindow",'Doing work necessary to request encryption key.'))))
|
||||||
|
|
||||||
target = 2 ** 64 / (shared.networkDefaultProofOfWorkNonceTrialsPerByte*(len(payload) + 8 + shared.networkDefaultPayloadLengthExtraBytes + ((TTL*(len(payload)+8+shared.networkDefaultPayloadLengthExtraBytes))/(2 ** 16))))
|
target = 2 ** 64 / (shared.networkDefaultProofOfWorkNonceTrialsPerByte*(len(payload) + 8 + shared.networkDefaultPayloadLengthExtraBytes + ((TTL*(len(payload)+8+shared.networkDefaultPayloadLengthExtraBytes))/(2 ** 16))))
|
||||||
initialHash = hashlib.sha512(payload).digest()
|
initialHash = hashlib.sha512(payload).digest()
|
||||||
|
@ -934,8 +934,8 @@ class singleWorker(threading.Thread, StoppableThread):
|
||||||
toAddress)
|
toAddress)
|
||||||
|
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', tr.translateText("MainWindow",'Broadcasting the public key request. This program will auto-retry if they are offline.')))
|
'updateStatusBar', tr._translate("MainWindow",'Broadcasting the public key request. This program will auto-retry if they are offline.')))
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByToAddress', (toAddress, tr.translateText("MainWindow",'Sending public key request. Waiting for reply. Requested at %1').arg(l10n.formatTimestamp()))))
|
shared.UISignalQueue.put(('updateSentItemStatusByToAddress', (toAddress, tr._translate("MainWindow",'Sending public key request. Waiting for reply. Requested at %1').arg(l10n.formatTimestamp()))))
|
||||||
|
|
||||||
def generateFullAckMessage(self, ackdata, toStreamNumber, TTL):
|
def generateFullAckMessage(self, ackdata, toStreamNumber, TTL):
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,7 @@ class sqlThread(threading.Thread):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(While null value test) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal('(While null value test) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
shared.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||||
if shared.daemon:
|
if shared.daemon:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
|
@ -465,7 +465,7 @@ class sqlThread(threading.Thread):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(While VACUUM) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal('(While VACUUM) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
shared.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||||
if shared.daemon:
|
if shared.daemon:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
|
@ -482,7 +482,7 @@ class sqlThread(threading.Thread):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(While committing) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal('(While committing) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
shared.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||||
if shared.daemon:
|
if shared.daemon:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
|
@ -500,7 +500,7 @@ class sqlThread(threading.Thread):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while movemessagstoprog) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal('(while movemessagstoprog) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
shared.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||||
if shared.daemon:
|
if shared.daemon:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
|
@ -519,7 +519,7 @@ class sqlThread(threading.Thread):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while movemessagstoappdata) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal('(while movemessagstoappdata) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
shared.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||||
if shared.daemon:
|
if shared.daemon:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
|
@ -539,7 +539,7 @@ class sqlThread(threading.Thread):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while deleteandvacuume) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal('(while deleteandvacuume) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
shared.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||||
if shared.daemon:
|
if shared.daemon:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
|
@ -555,7 +555,7 @@ class sqlThread(threading.Thread):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while cur.execute) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal('(while cur.execute) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
shared.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||||
if shared.daemon:
|
if shared.daemon:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -90,21 +90,21 @@ class namecoinConnection (object):
|
||||||
assert False
|
assert False
|
||||||
except RPCError as exc:
|
except RPCError as exc:
|
||||||
if exc.error["code"] == -4:
|
if exc.error["code"] == -4:
|
||||||
return (tr.translateText("MainWindow",'The name %1 was not found.').arg(unicode(string)), None)
|
return (tr._translate("MainWindow",'The name %1 was not found.').arg(unicode(string)), None)
|
||||||
else:
|
else:
|
||||||
return (tr.translateText("MainWindow",'The namecoin query failed (%1)').arg(unicode(exc.error["message"])), None)
|
return (tr._translate("MainWindow",'The namecoin query failed (%1)').arg(unicode(exc.error["message"])), None)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print "Namecoin query exception: %s" % str (exc)
|
print "Namecoin query exception: %s" % str (exc)
|
||||||
return (tr.translateText("MainWindow",'The namecoin query failed.'), None)
|
return (tr._translate("MainWindow",'The namecoin query failed.'), None)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
val = json.loads (res)
|
val = json.loads (res)
|
||||||
except:
|
except:
|
||||||
return (tr.translateText("MainWindow",'The name %1 has no valid JSON data.').arg(unicode(string)), None)
|
return (tr._translate("MainWindow",'The name %1 has no valid JSON data.').arg(unicode(string)), None)
|
||||||
|
|
||||||
if "bitmessage" in val:
|
if "bitmessage" in val:
|
||||||
return (None, val["bitmessage"])
|
return (None, val["bitmessage"])
|
||||||
return (tr.translateText("MainWindow",'The name %1 has no associated Bitmessage address.').arg(unicode(string)), None)
|
return (tr._translate("MainWindow",'The name %1 has no associated Bitmessage address.').arg(unicode(string)), None)
|
||||||
|
|
||||||
# Test the connection settings. This routine tries to query a "getinfo"
|
# Test the connection settings. This routine tries to query a "getinfo"
|
||||||
# command, and builds either an error message or a success message with
|
# command, and builds either an error message or a success message with
|
||||||
|
@ -124,16 +124,16 @@ class namecoinConnection (object):
|
||||||
versStr = "0.%d.%d" % (v1, v2)
|
versStr = "0.%d.%d" % (v1, v2)
|
||||||
else:
|
else:
|
||||||
versStr = "0.%d.%d.%d" % (v1, v2, v3)
|
versStr = "0.%d.%d.%d" % (v1, v2, v3)
|
||||||
return ('success', tr.translateText("MainWindow",'Success! Namecoind version %1 running.').arg(unicode(versStr)) )
|
return ('success', tr._translate("MainWindow",'Success! Namecoind version %1 running.').arg(unicode(versStr)) )
|
||||||
|
|
||||||
elif self.nmctype == "nmcontrol":
|
elif self.nmctype == "nmcontrol":
|
||||||
res = self.callRPC ("data", ["status"])
|
res = self.callRPC ("data", ["status"])
|
||||||
prefix = "Plugin data running"
|
prefix = "Plugin data running"
|
||||||
if ("reply" in res) and res["reply"][:len(prefix)] == prefix:
|
if ("reply" in res) and res["reply"][:len(prefix)] == prefix:
|
||||||
return ('success', tr.translateText("MainWindow",'Success! NMControll is up and running.'))
|
return ('success', tr._translate("MainWindow",'Success! NMControll is up and running.'))
|
||||||
|
|
||||||
print "Unexpected nmcontrol reply: %s" % res
|
print "Unexpected nmcontrol reply: %s" % res
|
||||||
return ('failed', tr.translateText("MainWindow",'Couldn\'t understand NMControl.'))
|
return ('failed', tr._translate("MainWindow",'Couldn\'t understand NMControl.'))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
|
|
|
@ -97,7 +97,7 @@ def _doGPUPoW(target, initialHash):
|
||||||
#print "{} - value {} < {}".format(nonce, trialValue, target)
|
#print "{} - value {} < {}".format(nonce, trialValue, target)
|
||||||
if trialValue > target:
|
if trialValue > target:
|
||||||
deviceNames = ", ".join(gpu.name for gpu in openclpow.gpus)
|
deviceNames = ", ".join(gpu.name for gpu in openclpow.gpus)
|
||||||
UISignalQueue.put(('updateStatusBar', tr.translateText("MainWindow",'Your GPU(s) did not calculate correctly, disabling OpenCL. Please report to the developers.')))
|
UISignalQueue.put(('updateStatusBar', tr._translate("MainWindow",'Your GPU(s) did not calculate correctly, disabling OpenCL. Please report to the developers.')))
|
||||||
logger.error("Your GPUs (%s) did not calculate correctly, disabling OpenCL. Please report to the developers.", deviceNames)
|
logger.error("Your GPUs (%s) did not calculate correctly, disabling OpenCL. Please report to the developers.", deviceNames)
|
||||||
openclpow.ctx = False
|
openclpow.ctx = False
|
||||||
raise Exception("GPU did not calculate correctly.")
|
raise Exception("GPU did not calculate correctly.")
|
||||||
|
|
|
@ -204,7 +204,7 @@ class uPnPThread(threading.Thread, StoppableThread):
|
||||||
logger.debug("Found UPnP router at %s", ip)
|
logger.debug("Found UPnP router at %s", ip)
|
||||||
self.routers.append(newRouter)
|
self.routers.append(newRouter)
|
||||||
self.createPortMapping(newRouter)
|
self.createPortMapping(newRouter)
|
||||||
shared.UISignalQueue.put(('updateStatusBar', tr.translateText("MainWindow",'UPnP port mapping established on port %1').arg(str(self.extPort))))
|
shared.UISignalQueue.put(('updateStatusBar', tr._translate("MainWindow",'UPnP port mapping established on port %1').arg(str(self.extPort))))
|
||||||
break
|
break
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
pass
|
pass
|
||||||
|
@ -228,7 +228,7 @@ class uPnPThread(threading.Thread, StoppableThread):
|
||||||
self.deletePortMapping(router)
|
self.deletePortMapping(router)
|
||||||
shared.extPort = None
|
shared.extPort = None
|
||||||
if deleted:
|
if deleted:
|
||||||
shared.UISignalQueue.put(('updateStatusBar', tr.translateText("MainWindow",'UPnP port mapping removed')))
|
shared.UISignalQueue.put(('updateStatusBar', tr._translate("MainWindow",'UPnP port mapping removed')))
|
||||||
logger.debug("UPnP thread done")
|
logger.debug("UPnP thread done")
|
||||||
|
|
||||||
def getLocalIP(self):
|
def getLocalIP(self):
|
||||||
|
|
Reference in New Issue
Block a user