Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit e58b22b

Browse files
committed
Use itertools.count() & remove unrealistic bound
1 parent 15e5345 commit e58b22b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ethereum/chain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import time
2-
from itertools import count, islice
2+
import itertools
33
from ethereum import utils
44
from ethereum.utils import parse_as_bin, big_endian_to_int
55
from ethereum import parse_genesis_declaration
@@ -264,7 +264,7 @@ def add_block(self, block):
264264
break
265265
b = self.get_parent(b)
266266
replace_from = b.header.number
267-
for i in islice(count(), replace_from, 2**63 - 1):
267+
for i in itertools.count(replace_from):
268268
log.info('Rewriting height %d' % i)
269269
key = 'block:' + str(i)
270270
orig_at_height = self.db.get(key) if key in self.db else None
@@ -325,7 +325,7 @@ def get_chain(self, frm=None, to=2**63 - 1):
325325
if frm is None:
326326
frm = int(self.db.get('GENESIS_NUMBER')) + 1
327327
chain = []
328-
for i in islice(count(), frm, to):
328+
for i in itertools.islice(itertools.count(), frm, to):
329329
h = self.get_blockhash_by_number(i)
330330
if not h:
331331
return chain

0 commit comments

Comments
 (0)