Closed JohnDoee closed 4 years ago
Describe the bug Integer seems to be converted to float at https://github.com/bmuller/kademlia/blob/master/kademlia/routing.py#L26 - floats are not precise enough to represent the correct number and therefore both buckets will have overlapping start and end range.
To Reproduce Split a bucket and check datatype.
$ python3 Python 3.7.5 (default, Nov 20 2019, 09:21:52) [GCC 9.2.1 20191008] on linux Type "help", "copyright", "credits" or "license" for more information. >>> (2**160) / 2 7.307508186654515e+47 >>> type((2**160) / 2) <class 'float'> >>> (2**160) // 2 730750818665451459101842416358141509827966271488 >>> type((2**160) // 2) <class 'int'>
Great catch - thanks @JohnDoee!
Describe the bug Integer seems to be converted to float at https://github.com/bmuller/kademlia/blob/master/kademlia/routing.py#L26 - floats are not precise enough to represent the correct number and therefore both buckets will have overlapping start and end range.
To Reproduce Split a bucket and check datatype.