fix lbryid length comparison

This commit is contained in:
Jack Robison 2017-10-11 23:23:07 -04:00
parent 4b0082d5bc
commit d23d4c1d73
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF

View file

@ -484,8 +484,9 @@ class Node(object):
raise TypeError, 'No port available'
if 'lbryid' in value:
if len(value['lbryid']) > constants.key_bits:
raise ValueError, 'Invalid lbryid'
if len(value['lbryid']) != constants.key_bits / 8:
raise ValueError('Invalid lbryid (%i bytes): %s' % (len(value['lbryid']),
value['lbryid'].encode('hex')))
else:
compact_address = compact_ip + compact_port + value['lbryid']
else: