1
0

test_lnpeer: some clean-up, make it easier to add "num_node>2" tests

This commit is contained in:
SomberNight
2020-05-06 10:44:38 +02:00
parent 7951f2ed3b
commit 04d018cd0f
3 changed files with 72 additions and 48 deletions

View File

@@ -44,12 +44,12 @@ class PRNG:
self.sha = sha256(seed)
self.pool = bytearray()
def get_bytes(self, n):
def get_bytes(self, n: int) -> bytes:
while len(self.pool) < n:
self.pool.extend(self.sha)
self.sha = sha256(self.sha)
result, self.pool = self.pool[:n], self.pool[n:]
return result
return bytes(result)
def randint(self, start, end):
# Returns random integer in [start, end)