Fix address generation bug (3 null bytes on beginning of RIPE hash) #116

Merged
Atheros1 merged 3 commits from master into master 2013-04-07 22:48:35 +02:00
Showing only changes of commit fc69d42acf - Show all commits

View File

@ -97,7 +97,7 @@ def calculateInventoryHash(data):
def encodeAddress(version,stream,ripe): def encodeAddress(version,stream,ripe):
if version >= 2: if version >= 2:
if len(ripe) != 20: if len(ripe) != 20:
sys.stderr.write('Programming error in encodeAddress: The length of a given ripe hash was not 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':