support for encoding and decoding variable length addresses #450

Merged
Atheros1 merged 7 commits from master into master 2013-08-26 21:29:30 +02:00
4 changed files with 12 additions and 12 deletions
Showing only changes of commit ef312c6e2c - Show all commits

View File

@ -525,8 +525,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
if status == 'versiontoohigh':
return 'API Error 0010: Address version number too high (or zero) in address: ' + toAddress
return 'API Error 0007: Could not decode address: ' + toAddress + ' : ' + status
if addressVersionNumber < 2 or addressVersionNumber > 3:
return 'API Error 0011: The address version number currently must be 2 or 3. Others aren\'t supported. Check the toAddress.'
if addressVersionNumber < 2 or addressVersionNumber > 4:
return 'API Error 0011: The address version number currently must be 2, 3, or 4. Others aren\'t supported. Check the toAddress.'
if streamNumber != 1:
return 'API Error 0012: The stream number must be 1. Others aren\'t supported. Check the toAddress.'
status, addressVersionNumber, streamNumber, fromRipe = decodeAddress(
@ -542,8 +542,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
if status == 'versiontoohigh':
return 'API Error 0010: Address version number too high (or zero) in address: ' + fromAddress
return 'API Error 0007: Could not decode address: ' + fromAddress + ' : ' + status
if addressVersionNumber < 2 or addressVersionNumber > 3:
return 'API Error 0011: The address version number currently must be 2 or 3. Others aren\'t supported. Check the fromAddress.'
if addressVersionNumber < 2 or addressVersionNumber > 4:
return 'API Error 0011: The address version number currently must be 2, 3, or 4. Others aren\'t supported. Check the fromAddress.'
if streamNumber != 1:
return 'API Error 0012: The stream number must be 1. Others aren\'t supported. Check the fromAddress.'
toAddress = addBMIfNotPresent(toAddress)
@ -607,8 +607,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
if status == 'versiontoohigh':
return 'API Error 0010: Address version number too high (or zero) in address: ' + fromAddress
return 'API Error 0007: Could not decode address: ' + fromAddress + ' : ' + status
if addressVersionNumber < 2 or addressVersionNumber > 3:
return 'API Error 0011: the address version number currently must be 2 or 3. Others aren\'t supported. Check the fromAddress.'
if addressVersionNumber < 2 or addressVersionNumber > 4:
return 'API Error 0011: the address version number currently must be 2, 3, or 4. Others aren\'t supported. Check the fromAddress.'
if streamNumber != 1:
return 'API Error 0012: the stream number must be 1. Others aren\'t supported. Check the fromAddress.'
fromAddress = addBMIfNotPresent(fromAddress)
@ -678,8 +678,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
if status == 'versiontoohigh':
return 'API Error 0010: Address version number too high (or zero) in address: ' + address
return 'API Error 0007: Could not decode address: ' + address + ' : ' + status
if addressVersionNumber < 2 or addressVersionNumber > 3:
return 'API Error 0011: The address version number currently must be 2 or 3. Others aren\'t supported.'
if addressVersionNumber < 2 or addressVersionNumber > 4:
return 'API Error 0011: The address version number currently must be 2, 3, or 4. Others aren\'t supported.'
if streamNumber != 1:
return 'API Error 0012: The stream number must be 1. Others aren\'t supported.'
# First we must check to see if the address is already in the

View File

@ -1572,7 +1572,7 @@ class MyForm(QtGui.QMainWindow):
continue
except:
pass
if addressVersionNumber > 3 or addressVersionNumber <= 1:
if addressVersionNumber > 4 or addressVersionNumber <= 1:
QMessageBox.about(self, _translate("MainWindow", "Address version number"), _translate(
"MainWindow", "Concerning the address %1, Bitmessage cannot understand address version numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(addressVersionNumber)))
continue

View File

@ -1216,7 +1216,7 @@ class receiveDataThread(threading.Thread):
if addressVersion == 0:
print '(Within processpubkey) addressVersion of 0 doesn\'t make sense.'
return
if addressVersion >= 4 or addressVersion == 1:
if addressVersion > 4 or addressVersion == 1:
with shared.printLock:
print 'This version of Bitmessage cannot handle version', addressVersion, 'addresses.'
@ -1273,7 +1273,7 @@ class receiveDataThread(threading.Thread):
shared.sqlLock.release()
# shared.workerQueue.put(('newpubkey',(addressVersion,streamNumber,ripe)))
self.possibleNewPubkey(ripe)
if addressVersion == 3:
if addressVersion == 3 or addressVersion == 4:
if len(data) < 170: # sanity check.
print '(within processpubkey) payloadLength less than 170. Sanity check failed.'
return

View File

@ -230,7 +230,7 @@ def reloadMyAddressHashes():
if isEnabled:
hasEnabledKeys = True
status,addressVersionNumber,streamNumber,hash = decodeAddress(addressInKeysFile)
if addressVersionNumber == 2 or addressVersionNumber == 3:
if addressVersionNumber == 2 or addressVersionNumber == 3 or addressVersionNumber == 4:
# Returns a simple 32 bytes of information encoded in 64 Hex characters,
# or null if there was an error.
privEncryptionKey = decodeWalletImportFormat(