reduce entropy on DHT test suite
This commit is contained in:
parent
0601bf3197
commit
31630a84be
3 changed files with 4 additions and 2 deletions
|
@ -114,7 +114,7 @@ class _Contact:
|
|||
return True
|
||||
|
||||
def __hash__(self):
|
||||
return int(hexlify(self.id), 16) if self.id else -1
|
||||
return int(hexlify(self.id), 16) if self.id else int(sum(int(x) for x in self.address.split('.')) + self.port)
|
||||
|
||||
def compact_ip(self):
|
||||
compact_ip = reduce(
|
||||
|
|
|
@ -167,7 +167,7 @@ class Node(MockKademliaHelper):
|
|||
self.__module__, self.__class__.__name__, binascii.hexlify(self.node_id), self.externalIP, self.port)
|
||||
|
||||
def __hash__(self):
|
||||
return self.node_id.__hash__()
|
||||
return int(binascii.hexlify(self.node_id), 16)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def stop(self):
|
||||
|
|
|
@ -108,6 +108,8 @@ class TestKademliaBase(unittest.TestCase):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def setUp(self):
|
||||
import random
|
||||
random.seed(0)
|
||||
self.nodes = []
|
||||
self._seeds = []
|
||||
self.clock = task.Clock()
|
||||
|
|
Loading…
Reference in a new issue