Skip to content

Commit 0284944

Browse files
committed
Cleanups
1 parent 1ba628d commit 0284944

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

trinity/protocol/bcc/servers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import functools
21
import itertools
32
from typing import (
43
cast,
@@ -9,7 +8,7 @@
98
Type,
109
)
1110

12-
from cytoolz import (
11+
from eth_utils.toolz import (
1312
cons,
1413
sliding_window,
1514
take,
@@ -101,7 +100,10 @@ async def _handle_get_beacon_blocks(self, peer: BCCPeer, msg: Dict[str, Any]) ->
101100
def _get_blocks(self,
102101
start_block: BaseBeaconBlock,
103102
max_blocks: int) -> Iterable[BaseBeaconBlock]:
104-
if max_blocks <= 0:
103+
if max_blocks < 0:
104+
raise Exception("Invariant: max blocks cannot be negative")
105+
106+
if max_blocks == 0:
105107
return
106108

107109
yield start_block

0 commit comments

Comments
 (0)