diff --git a/ChangeLog b/ChangeLog index c431dc6e9..e9548a214 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * Fixed invalid calculation in DHT node distance * Fixed bug in URL parser that failed to parse IPv6 addresses * added peer download rate approximation * added port filter for outgoing connection (to prevent diff --git a/src/kademlia/node_id.cpp b/src/kademlia/node_id.cpp index 52a5c766a..99f3df219 100644 --- a/src/kademlia/node_id.cpp +++ b/src/kademlia/node_id.cpp @@ -87,7 +87,7 @@ int distance_exp(node_id const& n1, node_id const& n2) // return the bit-number of the first bit // that differs int bit = byte * 8; - for (int b = 7; b > 0; --b) + for (int b = 7; b >= 0; --b) if (t >= (1 << b)) return bit + b; return bit; }