Merge branch 'master' of https://github.com/Atheros1/PyBitmessage
This commit is contained in:
commit
0ca3f600cc
|
@ -96,6 +96,8 @@ def calculateInventoryHash(data):
|
||||||
|
|
||||||
def encodeAddress(version,stream,ripe):
|
def encodeAddress(version,stream,ripe):
|
||||||
if version >= 2:
|
if version >= 2:
|
||||||
|
if len(ripe) != 20:
|
||||||
|
raise Exception("Programming error in encodeAddress: The length of a given ripe hash was not 20.")
|
||||||
if ripe[:2] == '\x00\x00':
|
if ripe[:2] == '\x00\x00':
|
||||||
ripe = ripe[2:]
|
ripe = ripe[2:]
|
||||||
elif ripe[:1] == '\x00':
|
elif ripe[:1] == '\x00':
|
||||||
|
@ -181,6 +183,12 @@ def decodeAddress(address):
|
||||||
return status,addressVersionNumber,streamNumber,data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]
|
return status,addressVersionNumber,streamNumber,data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]
|
||||||
elif len(data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]) == 18:
|
elif len(data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]) == 18:
|
||||||
return status,addressVersionNumber,streamNumber,'\x00\x00'+data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]
|
return status,addressVersionNumber,streamNumber,'\x00\x00'+data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]
|
||||||
|
elif len(data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]) < 18:
|
||||||
|
return 'ripetooshort',0,0,0
|
||||||
|
elif len(data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]) > 20:
|
||||||
|
return 'ripetoolong',0,0,0
|
||||||
|
else:
|
||||||
|
return 'otherproblem',0,0,0
|
||||||
|
|
||||||
def addBMIfNotPresent(address):
|
def addBMIfNotPresent(address):
|
||||||
address = str(address).strip()
|
address = str(address).strip()
|
||||||
|
|
|
@ -2608,10 +2608,7 @@ class addressGenerator(QThread):
|
||||||
break
|
break
|
||||||
print 'Generated address with ripe digest:', ripe.digest().encode('hex')
|
print 'Generated address with ripe digest:', ripe.digest().encode('hex')
|
||||||
print 'Address generator calculated', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix, 'addresses at', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix/(time.time()-startTime),'addresses per second before finding one with the correct ripe-prefix.'
|
print 'Address generator calculated', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix, 'addresses at', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix/(time.time()-startTime),'addresses per second before finding one with the correct ripe-prefix.'
|
||||||
if ripe.digest()[:2] == '\x00\x00':
|
address = encodeAddress(2,self.streamNumber,ripe.digest())
|
||||||
address = encodeAddress(2,self.streamNumber,ripe.digest()[2:])
|
|
||||||
elif ripe.digest()[:1] == '\x00':
|
|
||||||
address = encodeAddress(2,self.streamNumber,ripe.digest()[1:])
|
|
||||||
#self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"),'Finished generating address. Writing to keys.dat')
|
#self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"),'Finished generating address. Writing to keys.dat')
|
||||||
|
|
||||||
#An excellent way for us to store our keys is in Wallet Import Format. Let us convert now.
|
#An excellent way for us to store our keys is in Wallet Import Format. Let us convert now.
|
||||||
|
@ -2680,10 +2677,7 @@ class addressGenerator(QThread):
|
||||||
|
|
||||||
print 'ripe.digest', ripe.digest().encode('hex')
|
print 'ripe.digest', ripe.digest().encode('hex')
|
||||||
print 'Address generator calculated', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix, 'addresses at', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix/(time.time()-startTime),'keys per second.'
|
print 'Address generator calculated', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix, 'addresses at', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix/(time.time()-startTime),'keys per second.'
|
||||||
if ripe.digest()[:2] == '\x00\x00':
|
address = encodeAddress(2,self.streamNumber,ripe.digest())
|
||||||
address = encodeAddress(2,self.streamNumber,ripe.digest()[2:])
|
|
||||||
elif ripe.digest()[:1] == '\x00':
|
|
||||||
address = encodeAddress(2,self.streamNumber,ripe.digest()[1:])
|
|
||||||
#self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"),'Finished generating address. Writing to keys.dat')
|
#self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"),'Finished generating address. Writing to keys.dat')
|
||||||
|
|
||||||
#An excellent way for us to store our keys is in Wallet Import Format. Let us convert now.
|
#An excellent way for us to store our keys is in Wallet Import Format. Let us convert now.
|
||||||
|
@ -3276,6 +3270,10 @@ class NewSubscriptionDialog(QtGui.QDialog):
|
||||||
self.ui.labelSubscriptionAddressCheck.setText('The version number of this address is higher than this software can support. Please upgrade Bitmessage.')
|
self.ui.labelSubscriptionAddressCheck.setText('The version number of this address is higher than this software can support. Please upgrade Bitmessage.')
|
||||||
elif status == 'invalidcharacters':
|
elif status == 'invalidcharacters':
|
||||||
self.ui.labelSubscriptionAddressCheck.setText('The address contains invalid characters.')
|
self.ui.labelSubscriptionAddressCheck.setText('The address contains invalid characters.')
|
||||||
|
elif status == 'ripetooshort':
|
||||||
|
self.ui.labelSubscriptionAddressCheck.setText('Some data encoded in the address is too short.')
|
||||||
|
elif status == 'ripetoolong':
|
||||||
|
self.ui.labelSubscriptionAddressCheck.setText('Some data encoded in the address is too long.')
|
||||||
elif status == 'success':
|
elif status == 'success':
|
||||||
self.ui.labelSubscriptionAddressCheck.setText('Address is valid.')
|
self.ui.labelSubscriptionAddressCheck.setText('Address is valid.')
|
||||||
|
|
||||||
|
@ -3935,12 +3933,18 @@ class MyForm(QtGui.QMainWindow):
|
||||||
printLock.release()
|
printLock.release()
|
||||||
if status == 'missingbm':
|
if status == 'missingbm':
|
||||||
self.statusBar().showMessage('Error: Bitmessage addresses start with BM- Please check ' + toAddress)
|
self.statusBar().showMessage('Error: Bitmessage addresses start with BM- Please check ' + toAddress)
|
||||||
if status == 'checksumfailed':
|
elif status == 'checksumfailed':
|
||||||
self.statusBar().showMessage('Error: The address ' + toAddress+' is not typed or copied correctly. Please check it.')
|
self.statusBar().showMessage('Error: The address ' + toAddress+' is not typed or copied correctly. Please check it.')
|
||||||
if status == 'invalidcharacters':
|
elif status == 'invalidcharacters':
|
||||||
self.statusBar().showMessage('Error: The address '+ toAddress+ ' contains invalid characters. Please check it.')
|
self.statusBar().showMessage('Error: The address '+ toAddress+ ' contains invalid characters. Please check it.')
|
||||||
if status == 'versiontoohigh':
|
elif status == 'versiontoohigh':
|
||||||
self.statusBar().showMessage('Error: The address version in '+ toAddress+ ' is too high. Either you need to upgrade your Bitmessage software or your acquaintance is being clever.')
|
self.statusBar().showMessage('Error: The address version in '+ toAddress+ ' is too high. Either you need to upgrade your Bitmessage software or your acquaintance is being clever.')
|
||||||
|
elif status == 'ripetooshort':
|
||||||
|
self.statusBar().showMessage('Error: Some data encoded in the address '+ toAddress+ ' is too short. There might be something wrong with the software of your acquaintance.')
|
||||||
|
elif status == 'ripetoolong':
|
||||||
|
self.statusBar().showMessage('Error: Some data encoded in the address '+ toAddress+ ' is too long. There might be something wrong with the software of your acquaintance.')
|
||||||
|
else:
|
||||||
|
self.statusBar().showMessage('Error: Something is wrong with the address '+ toAddress+ '.')
|
||||||
elif fromAddress == '':
|
elif fromAddress == '':
|
||||||
self.statusBar().showMessage('Error: You must specify a From address. If you don\'t have one, go to the \'Your Identities\' tab.')
|
self.statusBar().showMessage('Error: You must specify a From address. If you don\'t have one, go to the \'Your Identities\' tab.')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user